Welcome to WebmasterWorld Guest from 54.226.34.209

Forum Moderators: phranque

Message Too Old, No Replies

Redirect help

Need script

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

Junior Member

10+ Year Member

joined:Apr 18, 2002
posts:63
votes: 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.

THX!

ESSET

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

Moderator from GB 

WebmasterWorld Administrator ianturner is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 19, 2001
posts:3633
votes: 44


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)

Junior Member

10+ Year Member

joined:Apr 18, 2002
posts:63
votes: 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)

Moderator from GB 

WebmasterWorld Administrator ianturner is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 19, 2001
posts:3633
votes: 44


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 5, 2001
posts:2466
votes: 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.

DaveN

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

Junior Member

10+ Year Member

joined:Apr 18, 2002
posts:63
votes: 0


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

Senior Member

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

joined:Mar 31, 2002
posts:25430
votes: 0


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)

Preferred Member

10+ Year Member

joined:Feb 20, 2002
posts:603
votes: 0


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

(As above)

Ove

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

Senior Member from SE 

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 24, 2001
posts:786
votes: 0


Here is a little help of how it would look like

[webmasterworld.com...]

/Ove

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members