Possible to run userscript in IE11

I have a custom userscript that I'm running in Chrome and Firefox using Tampermonkey/Greasemonkey.

Is there any way of using this script in IE11? Or is there any plugins for IE11 that does what Tampermonkey/Greasemonkey does?

Answers:

Answer

TrixIE WPF4.5 claims to emulate Greasemonkey on IE11.

Unfortunately, the original Trixie and IE7Pro stopped working around IE8-ish.

Answer

A simple Google Search (I searched "greasemonkey for IE") yields various alternatives available for other browsers:

http://en.wikipedia.org/wiki/Greasemonkey#Equivalents_for_other_browsers

For Internet Explorer, similar functionality is offered by IE7Pro,[19] Sleipnir,[20] and iMacros.

Answer

Fiddler supports modifying the response of http requests.
We can use this feature to load userscript in any browser, include IE8.

This is an example:

static function OnBeforeResponse(oSession: Session) {
    if (m_Hide304s && oSession.responseCode == 304) {
        oSession["ui-hide"] = "true";
    }
    // match url
    if (oSession.fullUrl == "http://apply.ccopyright.com.cn/goadatadic/getR11List.do") {
        oSession.utilDecodeResponse();
        var script = System.IO.File.ReadAllText("C:\\GitHub\\@selpic\\P660_printer\\Printer\\scripts\\form-save-load.js")
        oSession.utilReplaceOnceInResponse("</body>", "<script>"+script+"</script></body>", true);
    }
}

doc: Modifying a Request or Response

Answer

I use localStorage to make it work, which is supported by IE8 or later.

Steps:

  1. Run the following code in IE's developer tool when the current window is in the domain where you want the script to run in:
var scriptName = 'Hello world';
function scriptBody(){
//---userscript starts--->

document.body.innerHTML = '<h1>Hello world!</h1>';

//---userscript ends--->
}
var script = scriptBody.toString()
  .split('//---userscript starts--->')[1]
  .split('//---userscript ends--->')[0];
localStorage.setItem(scriptName, script);
  1. Create a bookmark and modify the URL into:
javascript:(function(){eval(localStorage.getItem('Hello world'));})()

Advantages:

  • No additional plugin needed.
  • Almost no script text length limit.

Disadvantages:

  • Need a user to click on a bookmark to run the script.
  • Need a reinstall if a user clears the browser cache.
Answer

Just open Developer tools (press F12) and paste your script to Console, and then run it (Ctrl + Enter).

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.