PropellerAds offers a free CORS-bypassing proxy. Their ad code uses it, and so can you. It's not blocked by adblockers yet, but it should be. Blocked now :)
Just like fetch
, but only with a URL.
async function cssfetch(url){ | |
const frame = await new Promise(cb=> | |
document.body.appendChild( | |
Object.assign( | |
document.createElement("iframe"), | |
{ | |
srcdoc: "<div class=widget-col-10-sp></div><link rel=stylesheet href=\"https://cosatoos.com/lol.css?"+btoa(new URL(url, location.href).href)+"\">", | |
onload(){cb(this)}, | |
sandbox: "allow-same-origin", | |
width: 0, | |
height: 0, | |
frameBorder: 0 | |
} | |
) | |
) | |
) | |
response = getComputedStyle(frame.contentWindow.document.body.children[0], ':before').getPropertyValue('content').replace(/['"\(\)\s]/g, "") | |
if(response == "none") return new Response("Error", {status: 500}) | |
response = await fetch("data:application/octect-stream;base64,"+response) | |
return response | |
} |