Welcome to WebmasterWorld Guest from 54.159.250.110

Forum Moderators: phranque

Message Too Old, No Replies

Redirect help

Need script

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

10+ Year Member



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.

THX!

ESSET

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

WebmasterWorld Administrator ianturner is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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)

10+ Year Member



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)

WebmasterWorld Administrator ianturner is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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

or

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

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)

WebmasterWorld Senior Member 10+ Year Member



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.

DaveN

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

10+ Year Member



? Could you please show me how it would look. Iīm very not technical
2:46 pm on Oct 10, 2002 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Esset,

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.

Jim

gsx

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

10+ Year Member



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

(As above)

Ove

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

WebmasterWorld Senior Member 10+ Year Member



Here is a little help of how it would look like

[webmasterworld.com...]

/Ove