开发者

How do I turn javascript loading off when using URLConnection?

I'm looking to load the version of a site within the Noscript tags so the connection 开发者_如何学Pythonhas to appear like it has Javascript disabled.

Thanks!


The UrlConnection will doesn't not need to do anything with the noscript tag, in fact it can't. UrlConnection just gets the content, it doesn't try to parse it and do anything with JS/HTML, etc. It's just text data as far as it cares.

When the noscript comes into play is when you go to render the content.

Re your comment to your question - when you disable JS and go to that URL you're still getting the same content as when you requested the URL with JS on. If you look at the HTTP response in something like firebug you'll see it's always the same. It's the rendering engine that is doing something different, so you need to look at where your app renders the content and see if you can disable JS there.


Download the page, parse it, and look for an iframe like this:

<iframe
src="http://api.recaptcha.net/noscript?k=6LcQ8gUAAAAAAHGMy5-aJPjhxidK2lV1KLGyJYfO"
height="300" width="500" frameborder="0"></iframe>

Load the URL specified in the src attribute to get to the noscript version.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜