Welcome to WebmasterWorld Guest from 23.20.241.155

Forum Moderators: incrediBILL

Message Too Old, No Replies

Flash Intro Page

How to intergrate with homepage

     
7:12 pm on Feb 8, 2001 (gmt 0)

10+ Year Member



I'm trying to achieve homepage hit--redirect to Flash intro page--then back to downloaded homepage. I've been advised of the javascript method -- location.replace() -- and call it from an external .js file and http redirect via the "location" header. Are these the same and please can anyone tell me more accurately how to work this into the code ? Or point me in the right direction. Also is it safe with browsers ? Thanks in advance.
7:02 am on Feb 9, 2001 (gmt 0)

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



Javascript (client side) is a different thing from the Location Header (server side).

Here's a link for Location Header [cs.bu.edu].

And here's one for the JavaScript location.replace() method [webreference.com].

Note: I've read that, at least through version 4, Opera doesn't support relative URLs as arguments for the replace() method. So if you do go this route, it's best to use absolute URLs.

4:31 pm on Feb 9, 2001 (gmt 0)

10+ Year Member



Don't use location.replace in javascript, use location.href instead. location.replace plays with the back button, and is never worth using for this reason.

...
<script language="JavaScript">
<!--
location.href='redirect_to.html';
// -->
</script>
...

If you can redirect on the server side, this is far preferable - javascript may be turned off, and you don't want a "Redirecting you to a new page, click here if nothing happens" message.

6:46 pm on Feb 9, 2001 (gmt 0)

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



>> location.replace plays with the back button, and is never worth using for this reason.

First: I do agree that a server-side redirect is preferable.

Second: In client-side javascript I use replace() precisely because it changes the browser's history list.

Here's how I currently see the issue -- the viewer expects the BACK button to go the last page they SAW, and if they didn't see the last page in the history list, this becomes problematic. They click on the BACK button, go back to the page with the redirect code and get redirected again, right back to where they started.

The replace() method makes the button work exactly the way the visitor expects it to, and avoids putting them into a loop.

Because replace() does change the history list, stuart probably should not use it on the second move he described -- i.e. to go automatically from the Flash page back to the index page. The visitor has actually viewed the Flash and would expect the Back Button to return there, so the second redirect would use location.href= as you suggest.

But the initial redirect TO the Flash page seems like exactly the kind of situation that the replace() method was developed for.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month