Pretty simple just need some help coding this.
Looking for a javascript script to do this....
"Theoretical code that doesn't actually function but explains what I want"
[code]
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
if {useragent = steam game overlay}
load page = steam.html
else
load page = index.html
</script>
[/code]
THINGS I HAVE FOUND
Useragent string if using Steam game overlay
[code]Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; Valve Steam GameOverlay; ) AppleWebKit/534.1 (KHTML, like Gecko) Chrome/6.0.444.0 Safari/534.1[/code]
Useragent string if using Chrome
[code]Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.44 Safari/534.24[/code]
Please and thank you!
[code]
var overlay = (useragent.match('GameOverlay')) ? true : false;
if (overlay)
{
Blah
}
[/code]
Currently have it setup like this....
Not working though I keep getting sent over to the normal homepage
[code]
<!--*******************************
*****Steam Overlay Detection Script
********************************-->
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
var overlay = (useragent.match('GameOverlay')) ? true : false;
if (overlay)
{
location.href="/steam.html";
}
else
{
location.href="/index.html";
}
</SCRIPT>
[/code]
[code]
var overlay = (useragent.match(/GameOverlay/)) ? true : false;
if (overlay)
{
Blah
}
[/code]
Sorry no matter how I mess with the code I cannot get it to work.
[code]if (userAgent.match(/GameOverlay/i) == null) {
location.href = 'index.html';
} else {
location.href = 'steam.html';
}[/code]
Two things I noticed, useragent is not defined while userAgent is defined. Also, .match returns an array of matches, and null when there are no matches, not true/false.
I thought null is equal to false.
[QUOTE=jaybuz;29275581]I thought null is equal to false.[/QUOTE]
[img]http://gyazo.com/c53cf428d538bac0d1d4a247b73561c7.png[/img]
[img] [url]http://i.imgur.com/u9DER.png[/url] [/img]
[editline]18th April 2011[/editline]
Wait nevermind I see it
[editline]18th April 2011[/editline]
Removed it but it still doesn't work :/
Sneeep. Need to learn to read.
use .search, not .match, and use -1 instead of null
i got rid of that < to everyone who did't realize
also not_Morph is this what I should do?
[code]
<script language="JavaScript" type="text/javascript">
if (userAgent.search(/GameOverlay/i) == -1) {
location.href = 'index.html';
} else {
location.href = 'steam.html';
}
</script>
[/code]
[url]http://imgur.com/rVBXV[/url] <---- WHAT DOES IT MEAN?!
It means userAgent isn't defined.
[QUOTE=compwhizii;29278994]It means userAgent isn't defined.[/QUOTE]
Whoops, navigator.userAgent
Sorry, you need to Log In to post a reply to this thread.