I would like to know how to call a function once the user double-clicks on any word on the page they are visiting (from a content script). Something similar to Google Dictionary extension. I have inspected the codes in the extension but it was not indented (compiled/minimized) so I've decided to ask this question here. A snippet of codes would be good. Thanks in advance :)
相关问题
- Browsers render final comma of right-to-left (rtl)
- Chrome dev tools exact computed value for CSS rule
- Change Chromium icon and “chrome” text to custom i
- debugging webgl in chrome
- Shadow DOM CSS Styling from outside is not working
相关文章
- Is there a way to hide the new HTML5 spinbox contr
- Google Chrome Cache
- how to download a file on Chrome without auto rena
- Do all browsers on iOS use WKWebview or UIWebVIew?
- Why does Google Chrome NOT use cached pages when I
- Calling Chrome web browser from the webbrowser.get
- Progressive web app(PWA) vs Electron vs Browser ex
- Stop automatic scrolling on page content change
I suspect Google adds an EventListener to the page to register a double click, and then gets the text that was automatically selected.
http://developer.mozilla.org/en/DOM/element.addEventListener
http://developer.mozilla.org/en/DOM/window.getSelection