tags:

views:

35

answers:

1

hi there,

I have a window.onbeforeunload function, and I want to detect where I will get redirected to...

any ideas?

Markus

+1  A: 

You can't. It would be a security hole if you could.

If you want to find out where the user is going, then:

  • It has to be somewhere you are sending them
  • You need to handle it on the element which is sending them there

Linking to a redirect page on your own server is the simplest way to achieve this, buy be careful not to produce an open system that any spammer can relay people though to disguise their spam links.

David Dorward
This isn't necessarily true, a click handler on the exiting elements can give you this, when going forward anyway.
Nick Craver
It is in the onbeforeunload function specified in the question. I was expanding my answer to deal with options beyond that while you wrote your comment.
David Dorward
+1 Thanks for covering the bases :)
Nick Craver
The problem is, that The redirect comes for a flash plugin, which i cant detect with jquery...
Markus
Then you need to edit the Flash application.
David Dorward