/    Sign up×
Community /Pin to ProfileBookmark

Howto detect OS & Redirect

I would like to create a javascript to detect what Operating System a user has and send the user to particular web page depending on whether they use Windows XP or Windows 2000 Professional.

</script>
<script language=”JavaScript”>

var OSName=”Unknown OS”;
if (navigator.appVersion.indexOf(“5.1”)!=-1);
window.location=”http://web01/index_xp.htm” ;
Else
window.location=”http://web01“;

</script>

This is what I have so far but it only goes to the first page no matter what operating system I have. What do I have wrong?

Please be gentle, I am a newbie to scripting. If there is a good resource where I can learn how to do more of this, please let me know.

thanks,

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@PittimannMar 08.2004 — Hi!

Not knowing the rest of your code I can only say:

delete the semi colon at the end of the line with the if statement and please use "else" instead of "Else"...

Cheers - Pit
Copy linkTweet thisAlerts:
@mimorrauthorMar 08.2004 — Thank you Pit!

As I said, I am a newbie. I have changed the case of else and removed the semi-colon and it works now.

I hope to return the favor to someone in this group sometime.

Thanks,
Copy linkTweet thisAlerts:
@PittimannMar 08.2004 — Hi!

You're welcome! :pI hope to return the favor to someone in this group sometime.[/QUOTE]Go ahead! There can never be enough people here to give advice to others. ?

Cheers - Pit
×

Success!

Help @mimorr spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...