Click to See Complete Forum and Search --> : help! url redirection.


spk921803
12-13-2003, 04:38 PM
i know you can redirect url using javascript using this code here http://javascript.internet.com/navigation/timed-redirect.html, but is there any way i can redirect to two urls in a row?

I mean, I want the second url to be the final destination, but before I hit the second url, I want to make sure that I am hitting the first url. For example, I want it to be redirected to www.yahoo.com and then www.msn.com
Is there any way I can do this? I was advised to code 'REDIRECTOR' frame that is invisible to pass urls.. but not quite sure what it means..

any help would be really great.

thanks in advance.

- i dont have control over the first page that the first url will redirect to..

Dudsmack
12-13-2003, 05:08 PM
What I would do is this...create a <div></div> inside your page. Set this div's height/width properties to 100%. Load the first url into the div (using document.getElementByID(divName).location.href), then after your delay load the second url into the div. Or, if your dynamically create the div (using javascript) you can load the first page into the div, delete the entire div after your timer, and then forward the page to your second page.

A div is a block of text and you can access/modify a whole bunch of it's properties. Read up on CSS to learn about divs. Read up on dhtml to create/destory divs dynamically.

Just to warn you many pages nowadays will automatically detect if they are loaded into something else (frames, span, divs) and may try to break out.

pyro
12-13-2003, 06:09 PM
Originally posted by Dudsmack
using document.getElementByID(divName).location.hrefYou think that'll work for him?

fredmv
12-13-2003, 09:18 PM
Originally posted by Dudsmack
document.getElementByID(divName).location.hrefA few problems here: That's not the correct name of that method. It's actually getElementById — JavaScript is case-senstive so even an error that seems so minor is actually quite critical. I know it's just an example for the argument, however, divName would be incorrect; as the name of the method imples, you are getting a reference to the element by its id. Finally, there is no location property for HTMLElement objects — by default, that's actually a property of window and window only.