0

I'm using a site that has a contact block in a page. The person's name in the contact block is linked to a second page that shows their administrative rights via a column of check boxes.

I'm attempting to add a feature to an existing chrome extension I created that will open that link in the background (hidden) when the page is loaded, read which boxes are checked, and then add small images/suffixes to the person's name in the contact block so I can at a glance see what administrative rights they possess.

I'm slowly teaching myself how to send messages between the content script and background.html/background.js but I don't know how to begin loading and manipulating the site in the background pages.

Any help or direction of resources would be greatly appreciated. I tried to read the documentation on google's developer's site but it just isn't clicking for me.

1 Answers1

0

I think you can get the html through ajax request. for example(suppose you have included jquery)

$.get("http://stackoverflow.com/questions/40963011/how-do-i-load-url-in-background-page-and-parse-information-from-it-with-js", function(data){console.log(data)})

the data is just html string.

But if the page can't been accessed from public, you need get it from content script and pass the data to background.

Hope this is helpful.

Yang
  • 389
  • 2
  • 15
  • _"But if the page can't been accessed from public, you need get it from content script"_ XHR requests from background use the same credentials (e.g. cookies). – Xan Dec 05 '16 at 10:40
  • @yang hello can you demonstrate an example how to use that website cookies? and how to parsehtml in background – Jasbin Karki May 25 '22 at 05:03