Tuesday, September 20, 2011

Solution For HTTP_REFERER not working in IE

Solution For HTTP_REFERER not working in IE:

The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted. 

If we use this in the firefox,it will work as fine as it is.But if we use this for IE,it will not fetch the url of the previous window,
So we will use the Javascript code here to get the url of the referrer window like this,

var strReferrer = window.opener.location.href;
            $("#referrer").val(strReferrer);


use this code in your popup widow page js file,then pass that referrer url 'strReferrer' to the id 'referrer' to your tpl file as hidden value,

<input type="hidden" name="referpage" id="referrer" value="" />

then take this hidden value using $form value in ur module for your email the referrer window url,

$referrerpath = $form['aaa']['#post']['referrer'];

Here you can get that url,,,

No comments:

Post a Comment