4

I have been currently working on user scripts for Chrome that can function without the use of Tampermonkey. Today I added a third party extension (a userscript js) to the Chrome extensions:

// ==UserScript==
// @name       "job changer"
// @namespace  Marshmellows
// @version    0.1
// @description  Change 'Jobs' in stackoverflow to Hello!
// @match      http://stackoverflow.com/*
// @grant      none
// @run-at     document-start
// ==/UserScript==

document.addEventListener('DOMContentLoaded', function() {
    document.getElementById('nav-jobs').innerHTML = 'Hello!';
}, false);

I added this to the Chrome extensions by simply dragging the file inside (it worked fine).

I restarted Chrome and discovered that it had completely blocked my js file extension. It does not let me click enable! I can't seem to find a solution for this problem. I went on Chrome's forum and tried to find ways to create a .crx file. But because I am quite new to web development and the DOM, I feel like I need some guidance. Can anything be done?

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
  • You might want to check the suggested solutions in this [SO post](http://superuser.com/questions/450893/how-to-install-a-private-user-script-in-chrome-21) and see what works for you. – Teyam Nov 25 '16 at 17:43
  • @Teyam, pretty sure those answers stopped working after, about, August 2014. Irregardless, it doesn't stop the script from getting auto-disabled; I just verified that. – Brock Adams Nov 28 '16 at 05:37

1 Answers1

5

As you discovered, although you can still install a plain userscript by dragging it to the chrome://extensions/ page, it will be automatically disabled when Chrome restarts. Google claims that this is to "protect" users from malicious extensions.

To keep your userscript from being auto disabled, you must pack it into an extension manually. See the steps at the "Controlling the Script and name" section of this answer.

Extensions installed this way will not be auto-disabled, but they will trigger a popup warning on every single start of Chrome!
Google refuses to provide developers any recourse to that popup. To avoid it, you must register your new extension in the Google Pay Store.

Unless you plan to graduate to extension development, or you just love needless hassle, it would be foolish to do this for a userscript. Just install Tampermonkey and enjoy how easy and powerful userscript development can be.

Community
  • 1
  • 1
Brock Adams
  • 90,639
  • 22
  • 233
  • 295