Add custom CSP

    
      
  • /*
     * @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 です。

History

  1. 2017/03/11 19:10:06 - 2017-03-11
  2. 2017/03/09 20:41:43 - 2017-03-09
  3. 2017/03/09 20:32:05 - 2017-03-09
  4. 2017/03/06 00:42:06 - 2017-03-06