开发者

Can HtmlUnit handle JavaScript redirects?

Instead of automatically following JavaScript redirects, can I force HtmlUnit to return the URL the JavaScript wants to redirect me to?

// context:

If there's 5 JavaScript redirects in a row, I can only see the URL of the开发者_运维问答 page where it stopped - I can't view the 5 URLs it ran through.

Perhaps I can hook up the logger to a callback method to look for redirects? Not sure if this is possible, or how it would work..


You can do this by adding a WebWindowListener to the WebClient, and waiting for the webWindowContentChanged method to get called.


Previous answer is quite inaccurate :-(

I think that what you want to do is possible but you should use HtmlUnit mailing list to discuss it as it may require a bit hacking.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜