how to get the debug information for chrome extension -
i write dom tree protecter chrome extension examine if dom tree changes. have js files in background_page, how can console.logs() in other test html files? can find debug information of chrome://extensions/ when click on generated_background_page.html. how can information of other webpages? replying.
one thing have found useful when debugging chrome extensions use "inspect element" feature of chrome developer tools. if have page or element (such on popup extension) want debug:
open developer tools wait popup appear (if not up) switch elements view on developer tools click magnifying glass @ bottom can select element click on element in page want debug (e.g. popup page) now sources view , other views line match element you've clicked on. console let @ variables in context.
if not able extension work, there whole host of reasons.
- are scripts loaded form extension's directory or serving them site? chrome not load scripts external site unless on https , after site serving script has been whitelisted. see chrome content security policy more info.
- to inspect dom, need inject content script page being loaded. sure doing correctly? manifest.json must done right or else content script not loaded.
- for content script , extension communicate, must post , receive messages. more information available here.
perhaps best suggestion have follow chrome extension "tutorial" until have working , amend suit needs.
Comments
Post a Comment