简体   繁体   中英

running JavaScript function on url? google.com?javascript:(func())

I would like to run javascript 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

这是不可能的,因为如果是这样的话,那么XSS攻击可能就在每个链接的拐角处。

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM