CORS-via-GM

CORS via Greasemonkey/Tampermonkey

目前為 2022-03-06 提交的版本,檢視 最新版本

作者
FGFW
評價
0 0 0
版本
1.01
建立日期
2022-03-04
更新日期
2022-03-06
尺寸
1.9 KB
授權條款
WTFPL
腳本執行於

Description

This script enables web front-end developers to bypass "CORS" (a restriction imposed by browser security policies) to directly access other domains in the easiest and no-fuss way.

Usages

  • Simplest trial

    CORSViaGM.init(window)
    fetch('https://example.com')
    
  • Minimal full demo

    addEventListener('load', () => setTimeout(async () => {
      CORSViaGM.init(window)
      document.write(await (
        await fetch('https://example.com')
      ).text())
    }, 200))
    
  • Advanced
    If you want to await window._CORSViaGM.inited, add the following element to the <head> of your index.html:

    <script>
      window._CORSViaGM = (inited => ({ inited: Object.assign(new Promise(r => inited = r), { done: inited }) }))()
    </script>
    

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址