Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// ==UserScript==
// @name DOMNodeInserted Test
// ==/UserScript==
GM_setValue('test', 'works');
document.body.addEventListener('DOMNodeInserted', function(event) {
var access=GM_getValue('test', 'FAILS!!');
if ('undefined'==typeof access) access='FAILS!!';
alert('API Access: '+access);
}, true);
When run on the page below, this script will fail, logging:
Error: Greasemonkey access violation: unsafeWindow cannot call GM_getValue.
To the error console, and getting undefined in "access".
<script type="text/javascript">
function ins() {
var el=document.createElement('div');
<body onload='ins()'>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.