dynamically create greasemonkey script

Posted by qwertymk on Stack Overflow See other posts from Stack Overflow or by qwertymk
Published on 2011-01-30T23:17:11Z Indexed on 2011/01/30 23:25 UTC
Read the original article Hit count: 191

I'm trying to create a dynamic GM script. Here's what I thought would do it

win = window.open('myScript.user.js');
win.document.writeln('// ==UserScript==');
win.document.writeln('// @name          sample script');
win.document.writeln('// @description   alerts hi');
win.document.writeln('// @include       http://www.google.com/*');
win.document.writeln('// ==/UserScript==');
win.document.writeln('');
win.document.writeln('(function(){alert("hi");})()');
win.document.close();

Well it doesn't. Anyone have any ideas how to go about doing this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about dynamic