[Greasemonkey] Installing a user script via a data: url

Julien Couvreur julien.couvreur at gmail.com
Fri Apr 8 10:29:37 EDT 2005


Aaron says: "People cannot look at the script to see what it does."

Actually you can see exactly what you are installing. Please try the
page that I gave as an example or click on the data link at the bottom
of this email. After you click on that link, you can see the whole
script (as you normally would), review it and install it via the
"Tools/Install User Script" menu.


Aaron says: "Otherwise, why can't you use server-side scripting to generate
the script?"

I can, but in this case I wanted to go 100% javascript and not extra
server load.


Aaron says: "On the other hand, you may be able to work around this in
the current
implementation by putting a space, or some other delimiter, and then
".user.js"."

I tried a number of combinations to "trick" the ".user.js" detection
to work on data: urls, but none worked for me.


Cheers,
Julien

data:text/javascript;base64,Ly8gPT1Vc2VyU2NyaXB0PT0KLy8gQG5hbWUgICAgICAgICAgICBNeUN1c3RvbVVzZXJTY3JpcHQKLy8gQG5hbWVzcGFjZSAgICAgICBUT0RPCi8vIEBkZXNjcmlwdGlvbiAgICAgVE9ETwovLyBAaW5jbHVkZSAgICAgICAgICoKLy8gQGV4Y2x1ZGUgICAgICAgICAKLy8gPT0vVXNlclNjcmlwdD09Ci8vIEdlbmVyYXRlZCBieTogaHR0cDovL2Jsb2cubW9uc3R1ZmYuY29tL2FyY2hpdmVzL2ltYWdlcy9HcmVhc2VNb25rZXlTY3JpcHRHZW5lcmF0b3IuaHRtbAoKKGZ1bmN0aW9uKCkgewogICAvLyBmcmVlZm9ybSBjb2RlIGdvZXMgaGVyZQoKICAgLy8gaXRlcmF0ZSBvdmVyIGxpbmtzIGFuZCBhZGQgdGVtcGxhdGUKICAgdmFyIG9yaWdfcGFnZV9saW5rcyA9IGRvY3VtZW50LmxpbmtzOwogICB2YXIgcGFnZV9saW5rcyA9IG5ldyBBcnJheShvcmlnX3BhZ2VfbGlua3MubGVuZ3RoKTsKICAgZm9yICh2YXIgaT0wOyBpIDwgcGFnZV9saW5rcy5sZW5ndGg7IGkrKyl7CiAgICAgICBwYWdlX2xpbmtzW2ldID0gb3JpZ19wYWdlX2xpbmtz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