homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

Redirect help
Need script

 10:51 am on Oct 10, 2002 (gmt 0)

Does anyone know a java redirect script that doesnīt make the browser stuck? I mean that when the visitor is redirected he can use the backbutton on the browser and not be redirected again. Like the
META HTTP-EQUIV="refresh" content="0;URL=http://www.domain.com"

tag but a java script.





 11:12 am on Oct 10, 2002 (gmt 0)

Can you explain more clearly esset I don't quite understand what you are trying to do.


 11:16 am on Oct 10, 2002 (gmt 0)

Ok say i have a page indexed by a searchengine. If a user clicks on the page I want to redirect him to another page/site. (I know its not good but it dosenīt matter in this case). If the user clicks on the back button on the browser i want him to come back to the searchengine.

Do u understand?

Best regards Daniel


 11:38 am on Oct 10, 2002 (gmt 0)

What about using a personalised 404 page and deleting or renaming the original?


<Script Lang=javascript>
window.location.href = 'new_file.htm'

using inline javascript to redirect before the page is loaded - I'm not sure this will work but it is worth trying.


 11:02 am on Oct 10, 2002 (gmt 0)

you could use ASP to detect the http_referer then only redirect if not site you are redirecting to that would stop the loop.

if you want to be clever the redirect passes the http_referer to the the bounce page to new site which stores the bonco page and referer so when the back button is press you redirect the bounce page to the orginal referer.



 11:12 am on Oct 10, 2002 (gmt 0)

? Could you please show me how it would look. Iīm very not technical


 2:46 pm on Oct 10, 2002 (gmt 0)


I use the following script to escape from the frame of a referring site. I'm no JS expert, so this may not be the best method to do it, but my original comments in this snippet indicate that it will do what you want with a little work.

The trick here is to use the "location.replace" function. This overwrites the current URL in the "history" used by Back, Forward, and the browser history list, making the current page (the one with this script) disappear from the browser history:

<script language="JavaScript1.1" type="text/JavaScript"><!-- // hide from old browsers
if (parent.frames.length > 0) top.location.replace(document.location); // Escape from any referring site's frame, but enable one-click "Back". --></script>

I think if you modify it like this, it will do what you want:

<script language="JavaScript1.1" type="text/JavaScript"><!-- // hide from old browsers
location.replace('your_new_URL'); // Redirect to new URL, but enable one-click "Back". --></script>

I'm not sure what to for the <noscript> section, in case the user has javascript disabled... Maybe just provide a "Click here to continue to Our great <keyword> site! [webmasterworld.com]" link.

You might want to post over in the scripting forum for more options.



 2:57 pm on Oct 10, 2002 (gmt 0)

Use document.replace() instead of document.href=

(As above)


 3:39 pm on Oct 10, 2002 (gmt 0)

Here is a little help of how it would look like



Global Options:
 top home search open messages active posts  

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved