2

I want to get a url of the page where user is going after reaching to my webpage. Let say user just came to my website page xyz and now he entered the another url abc on the browser bar. So now i want to get a link of abc using jquery or javascript. Is it possible?

Ravi Kumar
  • 432
  • 4
  • 14
  • 2
    I certainly hope that is not possible. It would be a privacy violation imho. – NilsH May 02 '13 at 05:45
  • 1
    I don't think you're allowed to do that, it's a security violation. – Barmar May 02 '13 at 05:45
  • *"where user is going after reaching to my webpage"* - is the user leaving your webpage by clicking or link or by entering a new address in the browser bar? – Uooo May 02 '13 at 05:54
  • by entering a new address in the browser bar. actually i want to show user alert message with a redirecting url. – Ravi Kumar May 02 '13 at 06:01

1 Answers1

1

Because it can't be done. The new location is private/sensitive information. Nobody wants you to know which sites they visit when they leave your site.

How can i get the destination url in javascript onbeforeunload event?

But if you want to do something before unload than you can get help from below link.

jquery beforeunload does not display message

You got help from this

$(window).on('unload', function(){
});
Community
  • 1
  • 1
Kishan Patel
  • 1,358
  • 10
  • 24