Hi Everyone,
I am not a developer, but am trying to figure out how to redirect browsers going to my website. I've set up a separate html doc with this javascript code in my head tag:
<script language="JavaScript"
type="text/JavaScript">
if(navigator.appName == "WebTV")
{
window.location = "http://s364852370.onlinehome.us/HarmonicMotion/HarmonicMotionII/browse r.html"
}
if(navigator.appName == "Google Chrome")
{
window.location.href = "http://s364852370.onlinehome.us/HarmonicMotion/HarmonicMotionII/Harmon icMotionII.html"
}
if(navigator.appName == "Netscape")
{
window.location = "http://s364852370.onlinehome.us/HarmonicMotion/HarmonicMotionII/browse r.html"
}
if(navigator.appName == "Microsoft Internet Explorer")
{
window.location = "http://s364852370.onlinehome.us/HarmonicMotion/HarmonicMotionII/browse r.html"
}
window.location == "http://s364852370.onlinehome.us/HarmonicMotion/HarmonicMotionII/Harmon icMotionII.html"
</script>
The thing is, it seems to work on my browsers, but google chrome is not being directed to the place I specify. Rather it redirects to the same page as all the out of date browsers. Is my javascript not compatible with Chrome? and if so is there an other way to do this? I heard Javascript is testy with redirects, but couldn't find a better way to do this online. Let me know if I am doing something drastically wrong.
Thanks,
HM
Javascript browser sniffing is a dated, and not wholly reliable, approach which generates a lot of work for the web designer.
It has largely been replaced by responsive web design and progressive enhancement techniques.
http://coding.smashingmagazine.com/2011/01/12/guidelines-for-responsiv e-web-design/
Thanks, this is great.
My main problem though is that my website is designed using Adobe Edge, and works great on all browsers that can read HTML5. IE8 and Netscape both have problems doing so and I'd just like to direct people to download a newer browser. If this is impossible, then it may be easier for me to just drop it.
Again, I am not a web designer (which you can tell), and I'm definitely not looking for "a lot of work". BTW, the HTML5 looks amazing on smartphones, ipads, droids and all browsers that read HTML5, thanks to the ease of edge and the Adobe team.
If anyone else has any comments please feel free.
Thanks,
HM
North America
Europe, Middle East and Africa
Asia Pacific