How can I execute jQuery/JS code as soon as a jQuery/JS redirect like...
$(location).attr(\'href\',\'/target_path\');
...or...
You can't do that in the page that's redirecting. You can read the referrer in the landing page (document.referrer), and then decide whether to display an alert based on that, though.
document.referrer