Data scheme user scripts

已編輯 September 2016 腳本開發 Firefox

In order to provide my script an own context I tried to pass parameter as described in the wiki, but it didn't work.
The alternative with about:blank looks promising, but works with Greasymonkey only.

// ==UserScript==
// @name        test data scheme user script
// @namespace   gnblizz
// @description test
// @include     data:text*
// @include     about:blank?video=*
// @version     1
// @grant       none
// ==/UserScript==
document.body.innerHTML='it works.';
console.log('location =',location);

The test html has two iframes. If it works the content is "It works".

<!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>testing: Data scheme user scripts</title>
<iframe src="data:text/html;charset=utf-8,%3Chtml%3E%3Chead%3E%3Ctitle%3Edata:%20test%3C/title%3E%3C/head%3E%3Cbody%3EThis didn't work.%3C/body%3E%3C/html%3E%3C/pre%3E"></iframe><hr>
<iframe src="about:blank?"></iframe><hr>
<a href="" >Data scheme user scripts</a>

Does anybody know how to do something like this in chromium with Tampermonkey?


Sign In or Register to comment.