如何从Chrome扩展中获取javascript重页 [英] How to fetch javascript heavy pages from chrome extension
问题描述
我正在开发一个扩展,用于提取用户可能在网站上访问的页面。我的扩展使用jQuery.get()来获取页面。这适用于像amazon.com这样的网站。
但是,如果用户登录到gmail,并尝试获取其他页面(如帐户设置),则会得到不完整的页面。在该页面的某处,我收到了以下消息:
您的浏览器不支持Javascript或Javascript已被禁用。由于您的浏览器不支持Javascript或禁用Javascript,我们无法显示请求的页面。
在这种情况下,有什么方法可以获取完整页面?
我最终打开了一个新选项卡并获取该选项卡中的页面。然后使用内容脚本,我分析页面数据。当然,这是一个问题,用户会看到新打开的选项卡。但对用户来说也是透明的。
如果您使用Jetpack在Firefox上开发扩展,则可以使用页面工作器,它是一个不可见的页面并允许访问DOM。 $ b
I am developing an extension that fetches pages that the user is likely to access on a website. My extension uses jQuery.get() to fetch a page. This works correctly for a site like amazon.com.
But if the user logs in to gmail and I try to fetch some other pages like "account settings", I get an incomplete page. Somewhere in that page, I get the message:
"Your browser does not support Javascript or Javascript has been disabled.As your browser does not support Javascript or has Javascript disabled, we are not able to display the requested page."
Is there some way to fetch complete page in such cases?
I ended up opening a new tab and fetching the page in that tab. Then using content script, I analyze the page data. Sure this is a problem in the sense that a user will see newly opened tab. But then it is also transparent to the user.
If you are developing an extension on Firefox using Jetpack, you can use page-worker which is an invisible page and gives access to the DOM.
这篇关于如何从Chrome扩展中获取javascript重页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!