javascript - chrome extension get source html not currentPage -


how can source https://google.com when i'm in http://example.com in chrome extension. read: getting source html of current page chrome extension html currentpage only. need html source url. thanks!

  • use xmlhttprequest download whatever server responds when url accessed. on sites minipage script loader later render page in case loaded browser normally.

  • to rendered source or dom tree of arbitrary url you'll have load in tab first. make process less distracting user load in pinned tab:

    chrome.tabs.create({url: "https://google.com", pinned: true}, function(tab) {     .... wait tab load, source }); 

    (the simplest form of waiting doesn't require additional permissions periodic checking of tab.status == "complete" invoked above callback, otherwise use webnavigation.oncompleted example or inject content script run-of-the-mill "domcontentloaded" or "load" event handlers).

  • or load page in iframe sites forbid browser it.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -