This code is meant to supplement this Stackoverflow question: http://stackoverflow.com/q/32288996/145346
To use:
- Download these files into a folder.
- Open up Chrome extensions: chrome://extensions/
- Click on the "Developer mode" checkbox at the top
- Click on "Load unpacked extension..."
- Find the folder, and click ok
- An ugly smiley face icon will be added to the extension list.
- Click on the icon on any page to see every div get a light blue outline.
The issue with this code is that it won't open in a popup window, even though the chrome.tab.executeScript
includes a matchAboutBlank
option.
Use this demo: http://jsbin.com/tayuho/edit?js,output
-
Click on "Open popup"
-
Right click on the popup window header "Demo - Google Chrome" & select "Show as Tab"
-
Now click on the ugly smiley extension icon.
-
Nothing happens...
-
Right click on the ugly smiley extension popup and choose "Inspect Element"
-
In the Developer Tools window, choose "Console" and you'll see the error:
Unchecked runtime.lastError while running tabs.executeScript: Cannot access contents of url "". Extension manifest must request permission to access this host. at Object.callback (chrome-extension://.../popup.js:8:15)
See Chromium issue 530658 for more details.