Add custom CSP
by
unarist
2017-03-11 [2017/03/11 19:10:06]
お好みの Content-Security-Policy を追加して、制限を厳しくしてみよう
/*
* @title Apply custom CSP
* @description add/modify CSP meta tag & reload
* @include http://*
* @include https://*
* @license MIT License
* @javascript_url
*/
(function(){
let csp = document.querySelector('meta[http-equiv^="Content-Security-Policy"]') || document.createElement("meta");
csp.httpEquiv = "Content-Security-Policy";
csp.content = prompt("Enter policy:", "default-src 'self'") || '';
document.querySelector('head').appendChild(csp);
document.documentElement.innerHTML = document.documentElement.innerHTML;
})();
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。