Reputation: 31
Does anyone know if it is possible to link to a page using href and then calling a javascript function?
Ex: href="http://www.mywebsite.com/Details.aspx?javascript:__doPostBack('INFO','')
How would I go about this?
Thanks for your help!
Upvotes: 1
Views: 1616
Reputation: 732
One way would be to pass a variable to the page with a value, such as somelink.com?navigation=method
Then, on that page, GET the variable navigation
and write a simple if statement, such as:
if ( navigation === "someMethod" ){
theMethodToCall();
}
Upvotes: 1
Reputation: 71908
No, you cannot run javascript in another page like that. But you can prevent the default behavior of the click, load the page in an iframe, then run js there (same origin policy may apply).
Upvotes: 1