CORS-via-GM

CORS via Greasemonkey/Tampermonkey

ผู้เขียน
FGFW
จำนวนติดตั้งประจำวัน
2
จำนวนติดตั้งทั้งหมด
247
คะแนน
0 1 0
เวอร์ชัน
1.01
สร้างเมื่อ
04-03-2022
อัปเดตเมื่อ
06-03-2022
Size
1.85 กิโลไบต์
สัญญาอนุญาต
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>