简体   繁体   English

使用JS解析单页应用程序

[英]Parsing single page application using JS

I am working on a simple webapp in JS that parses a website to get some data. 我正在使用JS中的简单web应用程序来分析网站以获取一些数据。 The target website I want to parse is a single page web app. 我要解析的目标网站是单页Web应用程序。 When I do a XMLHttpRequest and get the html of the page, its mostly scripts and the elements which I am targeting in the page aren't there. 当我执行XMLHttpRequest并获取页面的html时,它的大部分脚本和我在页面中定位的元素都不存在。 The elements are visible when I access the page from the browser. 当我从浏览器访问页面时,这些元素是可见的。

I tried injecting the target html into my own page to execute the scripts inside it by doing 我尝试将目标html注入到我自己的页面中,以通过执行以下操作来执行其中的脚本

function tryExecuteJS(targetHtml){
    var flip = document.createElement("div");
    flip.className = 'jfflip';
    flip.style.display = 'none';
    flip.innerHTML=targetHtml;
    document.getElementsByTagName('head')[0].appendChild(flip);
}

and tried analysing the source but no luck. 并尝试分析来源,但没有运气。

Thanks 谢谢

使用chrome开发工具中的“网络”标签,然后使用xhr查看目标网站获取的URL,然后从脚本中访问这些URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM