我目前正在将JxBrowser用作Java应用程序中的嵌入式浏览器。我创建如下浏览器:
public static void main(String[] args) {
Browser browser = new Browser();
BrowserView browserView = new BrowserView(browser);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
frame.add(browserView, BorderLayout.CENTER);
frame.setSize(700, 500);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
browser.loadURL("https://developer.microsoft.com/en-us/graph");
frame.addWindowListener(new WindowListener() {
@Override
public void windowClosing(WindowEvent e) {
}
@Override
public void windowActivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowClosed(WindowEvent arg0) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.add(browserView, BorderLayout.CENTER);
frame.setSize(700, 500);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
browser.getCacheStorage().clearCache();
browser.loadURL("https://developer.microsoft.com/en-us/graph");
}
@Override
public void windowDeactivated(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void windowOpened(WindowEvent arg0) {
// TODO Auto-generated method stub
}
});
}
当打开第一个URL时,我登录并选择不让我登录。然后关闭该窗口,当第二个窗口打开时,我看到我的用户仍在登录。您可以看到我在第二次打开URL之前,还要清除缓存。但是不会清除缓存。
答案 0 :(得分:0)
我不确定问题是否与缓存有关。您能否创建一个简单的示例,以便从头到尾重现该问题?