Extension API Updates in Chrome 13
...you can now make cross-origin XMLHttpRequest calls with the privileges of the extension directly from your content script. You will no longer need to relay these requests through a background page; this should simplify your code. In some cases, it may even eliminate your need to use a background page. Here’s a sample extension which demonstrates the old way a content script could make a cross domain request. As you can see, the extension required a background page to route the cross-origin calls through a chrome.extension.onRequest listener. Using the new content script cross-origin capabilities, we were able to successfully rewrite the extension to completely eliminate the background page requirement. This reduces the memory required to run the extension, and reduces code complexity as well...
You can now (as of Chrome 13) directly execute cross-origin XMLHttpRequest calls from content script pages, as opposed to routing calls through the extension background page.
This is a real performance gain as the background page does not have to be riddled with listeners and in some cases can be removed from the extension all together. Content scripts are injected based on match patterns in the extensions manifest file.
Further advances include additional match pattern options and advances to the Proxy API
Leave a Comment
Your email address will not be published. Required fields are marked *