can JS suss out "on-site" vs off-site HTTP requests?

W

Word Painter

this may be more of an "html" issue, but I'll wing it.

i've got a multi-language site, where the home-page of each language group
features a link to a popup window that offers background info on site
management. the popup is fired by a javascript function, when they click
the site management link. there's also a "window close" function button so
they can nuke it as they please.

now, oddly, people who search for my site in the chinese language on google,
are sent directly to the site management popup window, which of course,
opens in their "full" browser window, and which also has no links back to
the main site, because it's meant to open only as an "accessory" to the main
site.

my question is this: is there any way, with Javascript, that I could
determine if they arrived at this window from "off-site" (ie, a google
search), and therefore offer such "off-site" visitors a link back to the
principal site, a link that would be hidden for visitors who clicked the
popup window from my own site?

hope this is not confusing...! Thanks for any help offered.


WordPainter
 
N

naixn

Word Painter wrote :
this may be more of an "html" issue, but I'll wing it.

i've got a multi-language site, where the home-page of each language group
features a link to a popup window that offers background info on site
management. the popup is fired by a javascript function, when they click
the site management link. there's also a "window close" function button so
they can nuke it as they please.

now, oddly, people who search for my site in the chinese language on google,
are sent directly to the site management popup window, which of course,
opens in their "full" browser window, and which also has no links back to
the main site, because it's meant to open only as an "accessory" to the main
site.

my question is this: is there any way, with Javascript, that I could
determine if they arrived at this window from "off-site" (ie, a google
search), and therefore offer such "off-site" visitors a link back to the
principal site, a link that would be hidden for visitors who clicked the
popup window from my own site?

hope this is not confusing...! Thanks for any help offered.


WordPainter

http://developer.mozilla.org/en/docs/DOM:window.opener

This may help you if you use window.open to open your link ;)
It allow you to have a reference on the opener window. If none, it means it has
been accessed directly, and then should be redirected.

You also have the $_SERVER['HTTP_REFERER'] in PHP, and the equivalent may exist
in many other web languages :)
 
T

Thomas 'PointedEars' Lahn

naixn said:
You also have the $_SERVER['HTTP_REFERER'] in PHP, and the equivalent may
exist in many other web languages :)

It is well known that Referer coding simply does not work on the Web, since
not all UAs submit that header, depending on the security level and user
preferences.


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,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top