Load Javascript from a URL through the Address bar or Bookmarklet

Asked

Viewed 56 times

0

I have some Userscripts and would like to run on my Windows Phone, but there is no app for WP like Greasemonkey or Tampermonkey.

Then I came up with a crazy idea but I believe it will work: Create a bookmarklet that when I call downloads the saved Userscript on some server and runs it.

To test in WP I created a Bookmark with the "URL": javascript:alert(location.href);, and when I call this Bookmark it shows me the address of the current website in Alert, blz.

So the idea would be +- this:

javascript:$.get("http://x.com/userscript.js", function(data, status){ //Aqui faria a "execução" o código baixado });

Good as always has a however, I do not know how I do to run the code that was downloaded, someone can give me some idea?

Grateful!

  • Can you run Firefox on WP? Nowadays you can install add-ons on FF mobile

1 answer

2

Uncompressed code:

javascript:-function() {
    var s = document.createElement('script');
    s.src = "http://x.com/userscript.js";
    document.head.appendChild(s);
}()
  • On the desktop everything right! on WP now I think it’s just I adjust the Userscripts, thank you very much!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.