This sample demonstrates technique of disabling alerts, error and confirmation dialogs. import com.jniwrapper.win32.ie.Browser; import javax.swing.*; import java.awt.*; /** * This sample demonstrates technique of disabling alerts, error and confirmation dialogs. */ public class DisableDialogsSample { private static final String HTML_CONTENT = "<html><body>" + "<button id='alertDiv' onclick='alert(\"alert shown\")'>Show alert</button><br />" + "<button id='confirmDiv' onclick='confirmation(\"alert shown\")'>Show confirmation</button><br />" + "<button id='errorDiv' onclick='document.all.unexistElement.innerHTML = \"some text\"'>Show error dialog</button>" + "</body></html>"; public static void main(String[] args) throws Exception { Browser browser = new Browser(); JFrame frame = new JFrame("JExplorer"); frame.getContentPane().add(browser, BorderLayout.CENTER); frame.setSize(700, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); // disable error, alert and confirmation dialogs browser.setSilent(true); browser.setContent(HTML_CONTENT); } } |
Examples >