KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to block a script file from loading on user defined websites. To block a script file I'm using beforeload event and event.preventDefault(); in content script which works fine as long as I already know website list. My problem is I don't know website list in advance, so to get the website list I'm sending a request to background page but response is asynchronous and unusable. Is there any synchronous message passing in Chrome Extensions that I possibly missed in Google's docs? // my (simplified) code from content script: document.addEventListener("beforeload", function(event) { chrome.extension.sendRequest({fnc:"is_owner"}, function(response) { // asynchronous response is not usable because // all scripts have already been loaded if (response.is_owner) event.preventDefault(); }); }, true);
Tags (comma-separated)
Save Edits
Cancel