Quiero crear una extensión de Chrome usando html, css, JavaScript simple. que debería bloquear todos los anuncios de marco en cualquier sitio web y reemplazarlos con mis anuncios que se crean en html simple.
Intento debajo del código,
var enabled = true; chrome.webRequest.onBeforeRequest.addListener( function(details) { if(enabled) { console.log("blocking:", details.url); chrome.tabs.executeScript(null, {file: "jquery.js"}, function() { chrome.tabs.executeScript(null, { file : content_script.js }); }); //alert(newSong); } //$(details).closest('iframe').remove(); return {cancel: enabled }; }, {urls: blocked_domains}, //{urls: ["<all_urls>"]}, /* replace with list of blacklisted urls */ ["blocking"] );y content_script.js
$(window).load(function() { $('iframe').each(function(){ //$(this).contents().find('img').remove(); $('iframe').attr('src','https://www.w3schools.com/css/rock600x400.jpg'); }); });también probé debajo del código pero nada de trabajo,
browser.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { //when current tab updated updateLabel(); }); browser.tabs.onActivated.addListener(function(activeInfo) { //when tab shift browser.tabs.get(activeInfo.tabId, function(tab){ updateLabel(); }); });por favor revise mi código o sugiérame un código simple.