Title: Java script question Post by: den68 on March 23, 2006, 05:36:22 AM anyone know how to do multiple redirects?
I've managed to get a single redirect to work using location.replace. I want to do redirects to different pages depending on what URL you are coming from. any clues? Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 06:12:22 AM If you know which URL they are coming from, then just use a nested if-else structure.
I think it would go something like this Code:
Title: Re: Java script question Post by: den68 on March 23, 2006, 08:38:46 AM I gave it a shot but it didn't seem to work. it just flipped the 2 url's back and forth without stopping.
Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 08:59:00 AM Huh???
Is the forwarding address the page itself? I'll try that out in a few minutes, when I get the time. Title: Re: Java script question Post by: den68 on March 23, 2006, 09:26:05 AM maybe I just put it in the wrong spot. does it go in the head tag or prior to it?
the url you have as _default is the page itself, correct? Title: Re: Java script question Post by: den68 on March 23, 2006, 10:06:23 AM here's the link:
http://www.cmgestore.com can you tell what's wrong? Title: Re: Java script question Post by: St0rmTK421 on March 23, 2006, 10:40:36 AM location.replace, that's a new one.  I've always used
window.location="http://www.yourdomain.com/"; but I assume both work. Looking at the code you start out with <script language="JavaScript"> { if(history.previous() == "http://www.energizerbunnystore.com") } Those two extra brackets don't need to be in there.  Just post the code in the same format that hydrobond posted inbetween the <script language="javascript"> and </script> tags. Also, after playing around, it seems like my browser likes "document.referrer" instead of "history.previous() ". Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 10:53:49 AM history.previous should have worked, but for some reason I couldn't get it to come back with anything but "undefined."  Referrer worked.
This should work.  Try it out (http://www.hydrobond.net/a.html) Won't let me post the code (http://www.hydrobond.net/info.html) w00t, quadruple digit post count! Title: Re: Java script question Post by: den68 on March 23, 2006, 11:26:58 AM okay, now what did I do wrong?
http://www.cmgestore.com/ Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 11:30:55 AM You can't have the destination be the same as the source page. You are forwarding the browser to the page you are currently on, which puts it into that loop.\
Change the URL in the ELSE statement to something like "http://www.cmgestore.com/index2.html" Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 11:32:30 AM Or better yet, if you want to stay on that page unless they are coming from the energizer page then you can take out the entire else statement. (Make sure you remove everything in the {} brackets too.)
Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 11:36:22 AM Oh, you only need the javascript on one of the pages, no need to the javascript on the destination page.
Title: Re: Java script question Post by: den68 on March 23, 2006, 11:40:52 AM okay, that broke the loop but now the links both just got to that main2 page.
Title: Re: Java script question Post by: den68 on March 23, 2006, 11:47:03 AM the energizer and cmgestore urls are both alias's that point to same IP address. could that be the problem?
Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 11:50:56 AM Ok, I looked at the code for www.energizerbunnystore.com and from what i can tell you won't need the IF statement there at all if all you want to do is send them directly to www.energizerbunnystore.com/eng2/
Then I would assume you can do away with the script on www.cmgestore.com altogether. I'm not 100% sure what you are trying to accomplish, can you explain in what you are trying to do with all this? Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 11:52:58 AM Quote the energizer and cmgestore urls are both alias's that point to same IP address. could that be the problem? I don't think there is a problem with that. I can access all three pages in question independantly, which wouldn't happen if there was an IP issue. Title: Re: Java script question Post by: den68 on March 23, 2006, 12:02:40 PM cmgestore is our webserver.
all the stores on it can be reached when including the /and 4 digit program ID. so cmgestore.com/eng2 goes to the energizer site. we created the alias energizerbunnystore.com so they don't have to use "cmg" the URL. the /eng2 is still needed to get to it. I'm tring to just make energizerbunnystore.com go directly to the site. I thought it neede to be redirected from the cmgestore main page. I'd like to be able to create aliases for other stores. so i guess the object is to have multiple redirects on the same page. I dom't know it that makes any sense. Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 12:12:46 PM All you need to do to accomplish that is to put a simple redirect script on the energizerstore page pointing to cmgestore/eng2/
This way, you won't need anything on the main page of www.cmgestore.com. Each of the other aliases will just be &orwarded from their own URL, if they have them. Title: Re: Java script question Post by: den68 on March 23, 2006, 12:22:49 PM there is no page for that URL. it's just a domain name that points to our web servers IP address.
Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 12:38:30 PM Ok, i think i know what you are saying now.
In that case, dont use document.referrer use document.URL I dont think you will have to change anything else but that. Title: Re: Java script question Post by: den68 on March 23, 2006, 12:50:01 PM http://www.energizerbunnystore.com
ugh. what did I f up this time? I appreciate the help man. sorry i'm so clueless with all this. Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 12:54:56 PM Wow... That is exactly what I have on www.hydrobond.net/try.html and it works fine there....
Just like this. (http://www.hydrobond.net/info.html) Title: Re: Java script question Post by: den68 on March 23, 2006, 01:16:32 PM whoa. I'm stumped too.
Title: Re: Java script question Post by: Hydrobond on March 23, 2006, 01:33:43 PM Try the alert(a) that I have in mine. That will give the the current address. Perhaps there is something strange going on with the URL????
Title: Re: Java script question Post by: den68 on March 24, 2006, 04:14:27 AM I did. it gave the alert but still went back to the same page.
Title: Re: Java script question Post by: Tynstar on March 24, 2006, 08:21:27 AM The RFGen email account has received 5-6 of these emails so far becasue of this thread.
Quote Scripting Abuse Detected! on Today at 1:02pm Abusing user ID (Real Name): den68 -> (den68) Abuse detected from IP: 208.x.xx.x Blocked script in form data: Code: <html> does this look right? RF Generation Message Board, The Guardian Title: Re: Java script question Post by: Hydrobond on March 24, 2006, 12:30:57 PM Did you get it working today, Den?
|