Note that there are some explanatory texts on larger screens.

plurals
  1. POChrome Extension API v17: webRequest onErrorOccurred.addListener
    primarykey
    data
    text
    <p>I am attempting to set up a chrome extension similar to <a href="http://code.google.com/chrome/extensions/trunk/samples.html#webrequest" rel="nofollow">http://code.google.com/chrome/extensions/trunk/samples.html#webrequest</a> except that it would us the onErrorOccurred listener instead to redirect to a specific known page when the get request fails for any reason.</p> <p>manifest.json:</p> <pre><code>{ "name": "Custom Error", "version": "0.1", "description": "Redirect all navigation errors to specified location/file.", "permissions": [ "webRequest", "tabs", "&lt;all_urls&gt;" ], "background": { "page": ["error_listener.html"] } } </code></pre> <p>error_listener.html:</p> <pre><code>&lt;!doctype html&gt; &lt;script&gt; chrome.webRequest.onErrorOccurred.addListener( function onErrorOccurred(details) { console.log('onBeforeRequest ', details.url); return { redirectUrl: 'http://www.google.com' } }, {urls: ["&lt;all_urls&gt;"]} //{urls: ["http://*/*", "https://*/*"]} ); //chrome.tabs.update(details.tabId, {url: "http://www.google.com", ['blocking']}); //alert("what?"); &lt;/script&gt; </code></pre> <p>The extension loads without any errors indicated yet the browser tab is not redirected. I have tried this using both Chrome 16 and Chrome 17; when using Chrome 16, I did change "chrome.webRequest" to "chrome.experimental.webRequest" and added "experimental" to the permissions list.</p> <p>So far it seems like the problem is that while the extension appears to be loaded when looking at chrome://extensions, the files are not actually loaded--when using Developer Tools, I don't see any reference to error_listener.html.</p> <p>I have also tried running Chrome 17 with the following flags: </p> <pre><code>8611 25/01/12-11:22:05&gt; google-chrome --restore-last-session --debug-on-start --log-level=0 --enable-logging --enable-extension-activity-logging --enable-extension-alerts --debug-plugin-loading --debug-print | tee &gt; log1.txt </code></pre> <p>Obviously, I am just kind of poking around in the dark with that command line. Anyone have any clue as to how to get this working? Thanks in advance for your help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload