I'd like to write an extension that will display a popup with a text box, where you enter a word, then the number of occurrences of this word on the current page's source code is displayed. How would I access the current page's source code? Do I have to add a permission in the manifest?
I think you can't. You can access the page's DOM source:
document.body.InnerHTML
document.head.InnerHTML
Though this is different from page source, because it contains results of JavaScript.
If you want to get the page source, you can just fire a XMLHTTPRequest at the page and search the results.
To get the current tab's URL you need the "tabs" permission. To download pages in the background page you need the "http://*/*" and (if you like) "https://*/*" permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With