I have built a cakephp app that needs the user to login or register(for new users), when he tries to download the file. And I use to javascript to redirect users to login page, and once they login I want users directed back to the download page they were on.
I am using
$this->redirect($this->referer());
works fine in chrome and FF. In IE it does not work. It redirects user back to home page.
document.referrer is blank.
I understand that in IE that document.referrer is populated only when user clicks on the link.
Is there a workaround or a hack to fix this(javascript or php). I appreciate any help.
Thanks.
I don’t know if this is applicable to you but most versions of IE also has a long-standing issue when using a confirm dialog. As sibidiba says, referer is unreliable – I’d pass the download page URL as a querystring param in your javascript redirect to login.