0

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

4 Answers 4

4

This is not possible, because if it were, then XSS attacks would potentially be around the corner of every link.

Sign up to request clarification or add additional context in comments.

1 Comment

I was wondering that would be the case. Thanks for confirming.
2

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.

Comments

0

That is impossible. You cannot control the code on other pages (this would be a huge security problem).

Comments

0

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?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.