Greasy Fork is available in English.

議論 » 開発

Data scheme user scripts

§
投稿日: 2016/09/16
編集日: 2016/09/16

Data scheme user scripts

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>
</head>
<body>
<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?video=http%3A%2F%2Fdummy.com%2Fdummy.mp4"></iframe><hr>
<a href="https://wiki.greasespot.net/Include_and_exclude_rules#Data_scheme_user_scripts" >Data scheme user scripts</a>
</body>
</html>

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

woxxomMod
§
投稿日: 2016/09/16

Tampermonkey doesn't inject scripts in about:blank.

@derjanb, is there a reason for not declaring "match_about_blank": true in TM's manifest and using it?

§
投稿日: 2016/09/17

@wOxxOm I remember that there were some issues, that's why I removed it some time ago. I'll re-check whether this is working now.

返信を投稿

返信を投稿するにはログインしてください。