Javascript Redirect

J

jonathan

Hi,

I want to ask something. Say I have a homepage oldhomepage.com

Then I have a new homepage called newhomepage.com

Now, I set up a redirection in oldhomepage.com

this.location = http://newhomepage.com

Say I want to check which homepages send traffic to
http://newhomepage.com

Because http://newhomepage.com gets traffic from redirection, than the
referrers in my stats will point at nothing or occasionally
http://oldhomepage.com

Say yahoo.com send traffic to http://oldhomepage.com how should I set
the redirect so that the server at http://newhomepage.com will know
where the real source is?

Should I put

this.location = http://newhomepage.com?referrer=document.referrer

Will that do?
 
T

Thomas 'PointedEars' Lahn

jonathan said:
Now, I set up a redirection in oldhomepage.com

this.location = http://newhomepage.com
^ ^
Won't work. The new value must be quoted.
Say I want to check which homepages send traffic to
http://newhomepage.com

Because http://newhomepage.com gets traffic from redirection, than the
referrers in my stats will point at nothing or occasionally
http://oldhomepage.com

Yes, indeed.
Say yahoo.com send traffic to http://oldhomepage.com how should I set
the redirect so that the server at http://newhomepage.com will know
where the real source is?

You could pass the referring URL as query part component.
You could also use URL rewrite (Apache: mod_rewrite).
Should I put

this.location = http://newhomepage.com?referrer=document.referrer
No.

Will that do?

No, and redirection with client-side scripting is evil[tm].

<http://www.w3.org/QA/Tips/reback>


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top