Script help and insight, Please

by Louis2
2 replies
HI,

On a couple of pages I use this script below to redirect to another site.
I like it as it goes between the </head> and <body tags.
I am actually able to run this with content/ images in the body which gets spidered.
First, will something like this get me the Big Google Slap?
Secondly, I only get a redirect from this and I would like to keep my own URL in the browser window
and then have it break out on the second click.
Obviously I'm no kind of webmaster since I only know enough to get me in trouble. LOL
Is there someone here who can point me in the right direction to,
either alter this so it does what I want it to do, Or another script that would work as I'd like.

Lastly, is it possible to get this to run inside a template (like a main index page) so I can include links to my other site pages.

I've searched for this and can't seem to find a worable solution for it.

Thanks to all who can help.
Cyber

<script>
//Browser redirect Script- © Dynamic Drive ()
//For full source code, 100's more DHTML scripts, and Terms Of Use,
//visit dynamicdrive
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)
//if NS 6
if (browser_type=="Netscape"&&browser_version>=5)
window.location.replace("/")
//if IE 4+
else if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
window.location.replace("/")
//if NS4+
else if (browser_type=="Netscape"&&browser_version>=4)
window.location.replace("/")
//Default goto page (NOT NS 4+ and NOT IE 4+)
else
window.location=". dynamicdrive.com"
</script>
#insight #script
  • Profile picture of the author mywebwork
    Where did you get this script? This looks like something I used back in 1997, and it probably is!

    This piece of Javacript redirects the user to a specific site based upon their web browser, however it's showing its age. It's setup to trap Netscape 5, Netscape 4 and IE version 4.

    The Netscape browser no longer exists, the final version was version 9 released in October 2007.

    The current version of Internet Explorer is version 8.

    Browsers like Firefox, Opera, Safari and Chrome will execute the last line.

    Scripts like this were used to compensate for some vast differences between the way these browsers rendered HTML, you literally ended up building a site exclusively for each browser. This was a royal pain to maintain, to say the least. In the 21st century this is no longer necessary, most browsers render HTML in a similar fashion (although IE still has it's quirks!).

    There are many ways to do a redirect, you may want to look for a more modern solution to your problem.

    Bill
    {{ DiscussionBoard.errors[703433].message }}
  • Profile picture of the author Louis2
    Thank you for the reply, Bill.

    I knew it was an antique, but hadn't seen much else that would act the same way other then a basic iframe redirect.

    I'll keep searching for another alternative.

    Thanks,

    Louis
    {{ DiscussionBoard.errors[703811].message }}

Trending Topics