Skip to content

Commit

Permalink
mention setHistoryPageCacheLimit(0) / setHistorySizeLimit(0) in the faq
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Dec 16, 2024
1 parent c8595eb commit c1b5676
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/site/fml/faq.fml
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ INFO: Redirect requested but followRedirects is disabled</source>
or implement your own CSSErrorHandler.
</p>
<source><![CDATA[
try (WebClient webClient = new WebClient(browserVersion)) {
webClient.setCssErrorHandler(new SilentCssErrorHandler());
....
Expand Down Expand Up @@ -336,11 +335,23 @@ INFO: Redirect requested but followRedirects is disabled</source>
</question>
<answer>
<p>
Make sure (a) that you are using the latest version of HtmlUnit, and
(b) that you are calling WebClient.close()
(or use <a href="http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html">try-with-resources</a>)
when you are finished with your WebClient instance.
Make sure
<ol>
<li>that you are using the latest version of HtmlUnit, and
<li>that you are calling WebClient.close() (or use <a href="http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html">try-with-resources</a>) when you are finished with your WebClient instance.
<ol>
</p>
<p>
Like real browsers HtmlUnit maintains a history for every window to be able to support the back() action. If you don't need this
you can disable the history by
</p>
<source><![CDATA[
try (WebClient webClient = new WebClient(browserVersion)) {
webClient.getOptions().setHistoryPageCacheLimit(0);
webClient.getOptions().setHistorySizeLimit(0);
....
}
]]></source>
</answer>
</faq>

Expand Down

0 comments on commit c1b5676

Please sign in to comment.