javascripturl

Call Javascript function from a URL


Is it possible to call a javascript function from the URL? I am basically trying to leverage JS methods in a page I don't have access to the source.

Something like: http://www.example.com/mypage.aspx?javascript:printHelloWorld()

I suspect the answer to this is no but, just wondered if there was a way to do it.


Solution

  • There isn't from a hyperlink, no. Not unless the page has script inside specifically for this and it's checking for some parameter....but for your question, no, there's no built-in support in browsers for this.

    There are however bookmarklets you can bookmark to quickly run JavaScript functions from your address bar; not sure if that meets your needs, but it's as close as it gets.