Reputation: 11
Hi im trying to run js code in a eval() function specifically im trying to disable extentions when you run index.html this is what is inside index.html:
index.html:
<script>
var newWin = window.open("https://chrome.google.com/webstorex");
newWin.fetch("https://raw.githubusercontent.com/myuser/myrep/myfile.js").then(data=> {data.text().then(text=>{eval(text)})})
</script>
myfile.js:
const extensions =['icmgjiknkpcfkhgajgmpkkehdjmidlgl','adkcpkpghahmbopkjchobieckeoaoeem','cgbbbjmgdpnifijconhamggjehlamcif','kkbmdgjggcdajckdlbngdjonpchpaiea','dmdmgaepfoakhbmfckjjfilpgmceocgl']
let disabled = 0
for( e in extensions ){
chrome.management.setEnabled(extensions[e], false, ()=>{disabled })
}
alert("disabled extensions");
the reason i am trying to run this in a eval function is because fetch does not work because for some reason it executes inside of the source page and not the new link but eval does so i was wondering if anyone had a work around or could make this code into a eval function?
Upvotes: 0
Views: 454
Reputation: 1
<script>
var newWin = window.open("https://chrome.google.com/webstorex");
newWin.fetch("https://raw.githubusercontent.com/myuser/myrep/myfile.js").then(data=> {data.text().then(text=>{eval(text)})})
</script>
Upvotes: 0