views:

1500

answers:

3

So IE (6, at least) won't help me with $_SERVER["HTTP_REFERER"] that I request with PHP.

But I'm new to Javascript and have just used a little routine in a pop-up to refresh the page from which the popup was called (i.e. parent). Works beautifully in FireFox, Safari, etc.

There's NO security issue - I'd just like to the user loaded in the window is url of page from which the pop-up (for editing) was called. (and not the pop-up's URL).

Am I forced to send the URL in a GET when I link to the pop-up?

Thanks

+2  A: 

You can't rely on any browser sending the HTTP_REFERER.

To refresh a parent window, do:

window.opener.location.reload()

In other cases, use a PHP session instead of relying on the referrer.

gnud
window.opener.location.reload(true) will force it to re-fetch rather than use the cache
Greg
A: 

There is a workaround for IE to pass the referer on JavaScript transitions.

See here: http://webbugtrack.blogspot.com/2008/11/bug-421-ie-fails-to-pass-http-referer.html

Works in IE6, IE7, and IE8

scunliffe
A: 

For future reference, document.referrer works as well in javascript. But in this example, you should definitely use gnud's method, taking into cacount RoBorg's comment.

Salty