admin管理员组文章数量:1122832
I have an issue similar to this one, except—as far as I can tell—my directives are correct as per the answer on that question.
My header is as follows:
// ==UserScript==
// @name My Userscript
// @namespace com.example.my-userscript
// @version 0.2.14
// @description Do things
// @author Doktor J
// @match .php?id=*
// @icon ;domain=example
// @require .5.1/jquery.min.js
// @require .min.js
// @license Mozilla Public License 2.0
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @connect example
// ==/UserScript==
However, when I call the following:
GM_xmlhttpRequest({
method: "GET",
url: ".csv",
onload: function (response) {
console.log(response.status);
myData = $.csv.toObjects(response.responseText);
}
});
I still get the following error:
VM122:10 injected: Refused to connect to ".csv": URL is not permitted
I have an issue similar to this one, except—as far as I can tell—my directives are correct as per the answer on that question.
My header is as follows:
// ==UserScript==
// @name My Userscript
// @namespace com.example.my-userscript
// @version 0.2.14
// @description Do things
// @author Doktor J
// @match https://example.com/index.php?id=*
// @icon https://www.google.com/s2/favicons?sz=64&domain=example.com
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// @require https://example.org/path/jquery-csv.min.js
// @license Mozilla Public License 2.0
// @grant GM_addStyle
// @grant GM_xmlhttpRequest
// @connect example.org
// ==/UserScript==
However, when I call the following:
GM_xmlhttpRequest({
method: "GET",
url: "https://example.org/path/data.csv",
onload: function (response) {
console.log(response.status);
myData = $.csv.toObjects(response.responseText);
}
});
I still get the following error:
VM122:10 injected: Refused to connect to "https://example.org/path/data.csv": URL is not permitted
Share
Improve this question
asked Nov 22, 2024 at 19:15
Doktor JDoktor J
1,1091 gold badge14 silver badges34 bronze badges
1 Answer
Reset to default 2Fun fact, apparently when you don't have the @connect
tag and that warning dialog comes up, if you don't respond quickly enough it blacklists the URL, and the blacklist appears to override the @connect
directive.
If this happens:
- go to your userscript in Tampermonkey, go to its "Settings" sub-tab (in the left-aligned tab bar below the main Tampermonkey tab bar, otherwise you'll end up in the Tampermonkey settings rather than your userscript's settings).
- Scroll down to "XHR Security" and check the "User domain blacklist" box
- Select your newly-blacklisted domain in there and click "Remove"
本文标签: javascriptconnect tag not working in TamperMonkeyChromeStack Overflow
版权声明:本文标题:javascript - @connect tag not working in TamperMonkeyChrome? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736301328a1931140.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论