running JavaScript function on url? google.com?javascript:(func())
I would like to run 开发者_StackOverflowjavascript function after link load. Link is for example google and I would like to run function after load, without pressing any bookmarks etc. Is it possible to make a link like
http://google.com?javascript:(function(){}(something here);)
Thanks for your answers
This is not possible, because if it were, then XSS attacks would potentially be around the corner of every link.
Nope, URLs just don't support this. There are bookmarklets the user can use once the page loads, but nothing you can automatically run as part of a URL.
That is impossible. You cannot control the code on other pages (this would be a huge security problem).
As everyone else has noted, you cannot run a Javascript function that way.
What is it that you're hoping to accomplish with your javascript? Perhaps there is another way to achieve your end result?
精彩评论