0

I was able to get the HTML source of the page by following the answer on this page: Getting the source HTML of the current page from chrome extension

However, it could not get the new HTML source which is dynamically loaded via AJAX even I close the popup, unless I manually refresh the page. It keeps loading the previous HTML source. I couldn't figure out why. I am new to chrome extension though. A little help is appreciated. Thanks.

Community
  • 1
  • 1
Eleonor Somosot
  • 109
  • 3
  • 10
  • It's not extension-specific. See [Is there a JavaScript/jQuery DOM change listener?](//stackoverflow.com/q/2844565) – wOxxOm May 02 '17 at 13:59
  • Thanks for the response.. Tried your suggestion. But still does not work. what im aiming is when I change to next page it should get the dynamically loaded document page when i click the extension icon again. MutationObserver detects DOM changes but the document is still from previous page. – Eleonor Somosot May 03 '17 at 06:21
  • What exactly doesn't work? Also, the document object is the same because it doesn't change on ajax navigation. Currently it's not clear what the problem is. – wOxxOm May 03 '17 at 11:21
  • I will try my best to picture out the problem.. I have a popup extension that when clicked, a window pops up and gets the html source (results page) and display the data on it.. when i click next page (results page), the next set of results are loaded dynamically.. if the extension window popup was not closed, it will just be focused and the content script would be executed again to get the supposedly new HTML source and update display.. But document object still has the previous HTML source.. even when I close extension it does not change.. – Eleonor Somosot May 04 '17 at 03:15
  • The verbal description doesn't help me understand the issue. Can you share the zip file of your extension? Also, the answer you've linked is really really weird because to get the html source all you need is `document.documentElement.innerHTML` – wOxxOm May 04 '17 at 03:26
  • That's another problem, I could not share zip file of codes because it's a company proprietary. – Eleonor Somosot May 04 '17 at 03:40
  • The whole point of the problem is when I execute content script that gets document source it does not get dynamically loaded page unless I refresh the page. Even I use document.documentElement.innerHTML. just using console.log would allow me to see what is fetched. The same implementation on linked URL. sample page: https://www.alibaba.com/trade/search?IndexArea=product_en&CatId=&fsb=y&SearchText=pillow – Eleonor Somosot May 04 '17 at 03:50
  • 1
    Again, it doesn't help. I just can't imagine how to encounter the problem you describe. – wOxxOm May 04 '17 at 13:00

0 Answers0