Loading Javascript from a URL through the address bar or Bookmarklet

0

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

So I came up with a crazy idea but I believe it will work: Create a bookmarklet that when I call down the Userscript saved on some server and executes 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 site in Alert, blz.

Then the idea would be + - this:

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

asked by anonymous 22.02.2016 / 21:54

1 answer

2

Unzipped code:

javascript:-function() {
    var s = document.createElement('script');
    s.src = "http://x.com/userscript.js";
    document.head.appendChild(s);
}()
    
22.02.2016 / 22:15