homepage Welcome to WebmasterWorld Guest from 23.23.8.131
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Flash Intro Page
How to intergrate with homepage
stuart

10+ Year Member



 
Msg#: 277 posted 7:12 pm on Feb 8, 2001 (gmt 0)

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.

 

tedster

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



 
Msg#: 277 posted 7:02 am on Feb 9, 2001 (gmt 0)

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.

nickwkg

10+ Year Member



 
Msg#: 277 posted 4:31 pm on Feb 9, 2001 (gmt 0)

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.

tedster

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



 
Msg#: 277 posted 6:46 pm on Feb 9, 2001 (gmt 0)

>> 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
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