Dynamic load cancelling at
runtime Preventing specific domains from loading with WebRenderer is
performed by the BrowserEvent blockLoad()
method. The blockLoad() method is only effective
if called within the onLoadIntercept method,
due to the order in which pages are loaded.
browser.addBrowserListener(new
BrowserAdapter(){ //Called
before any document is loaded or request
sent public void
onLoadIntercept(BrowserEvent e) { if(e.getURL().toLowerCase().indexOf("google.com")
!= -1) { //Call
to prevent URL from loading - no request
is sent to Web Server if this method is
called e.blockLoad();
} } });
An
alternative to using onLoadIntercept is
the IBrowserCanvas method stopLoad(). The
stopLoad method can be used in the onBeforeNavigate
BrowserEvent. stopLoad() will stop documents
loading much like a browser stop button.
Requests are usually sent to the web server
if stopLoad() is used, but document downloading
is cancelled. This is relevant for use in
a browser Stop button but may not be suitable
for automated trapping applications where
browser navigation is to be filtered.