hyperlink - Can I make a link 1. navigate away from page and 2. execute Javascript? -


I have a piece of JavaScript code that I want to execute on the page that the user navigates on. So I have

  & lt; A href = "www.google.com" & gt;   

and they want to execute it once upon clicking

  javascript: alert ("you are on Google")  < / Pre> 

Is there any way to do this?

I thought of setting up a PHP page that accepts a URL as a parameter and then wraps up JS, but it will affect my webserver traffic and maybe session based Websites do not work for ...

Thank you, no or, at least, you do Should not be able to. Running your Javascript on someone else's web site is a huge security hole.

Comments