Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » other IE process be killed when execute js "window.open"??
other IE process be killed when execute js "window.open"?? [message #493119] Fri, 23 October 2009 09:26 Go to next message
Eclipse UserFriend
Originally posted by: oliver.rcp.gmail.com

hi,every one!

i use OS.setParent etc..API to embed some ie windows to my swt
application,but when one of the IE window execute window.open function of
javascript,other ie window's process will be killed and cause these ie
windows disappeared. Microsoft acknowledged
that is IE's bug,any one know about that?any way to solve?

thanks a lot!!
Re: other IE process be killed when execute js "window.open"?? [message #493509 is a reply to message #493119] Mon, 26 October 2009 14:51 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2151
Registered: July 2009
Senior Member
Hi,

Why do you need to make OS calls? The snippet below demonstrates four IE
browsers (assuming you're on win32), the second of which does a
window.open() after 9 seconds, and it doesn't have problems for me. Is this
something like what you're trying to do? Does the snippet work for you?

public class ModifiedSnippet173 {

static final int BROWSER_STYLE = SWT.NONE;

public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout(2, true));

Browser browser;
try {
browser = new Browser(shell, BROWSER_STYLE);
} catch (SWTError e) {
System.out.println("Could not instantiate Browser: " +
e.getMessage());
display.dispose();
return;
}
initialize(display, browser);
browser.setUrl("http://www.eclipse.org");

try {
browser = new Browser(shell, BROWSER_STYLE);
} catch (SWTError e) {
System.out.println("Could not instantiate Browser: " +
e.getMessage());
display.dispose();
return;
}
initialize(display, browser);
browser.setText(
"<html>" +
"<script type=\"text/javascript\">" +
"setTimeout(\"window.open('http://www.eclipse.org', 'Dialog',
'width=100, height=100');\", 9000);" +
"</script>" +
"<body>" +
"This test uses javascript to open a new window after 9
seconds." +
"</body>" +
"</html>");

try {
browser = new Browser(shell, BROWSER_STYLE);
} catch (SWTError e) {
System.out.println("Could not instantiate Browser: " +
e.getMessage());
display.dispose();
return;
}
initialize(display, browser);
browser.setUrl("http://www.google.ca");

try {
browser = new Browser(shell, BROWSER_STYLE);
} catch (SWTError e) {
System.out.println("Could not instantiate Browser: " +
e.getMessage());
display.dispose();
return;
}
initialize(display, browser);
browser.setUrl("http://www.eclipse.org/swt");

shell.open();
/* any website with popups */
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}

/* register WindowEvent listeners */
static void initialize(final Display display, Browser browser) {
browser.setLayoutData(new GridData(GridData.FILL_BOTH));
browser.addOpenWindowListener(new OpenWindowListener() {
public void open(WindowEvent event) {
Shell shell = new Shell(display);
shell.setText("New Window");
shell.setLayout(new FillLayout());
Browser browser = new Browser(shell, BROWSER_STYLE);
initialize(display, browser);
event.browser = browser;
}
});
browser.addVisibilityWindowListener(new VisibilityWindowListener() {
public void hide(WindowEvent event) {
Browser browser = (Browser)event.widget;
Shell shell = browser.getShell();
shell.setVisible(false);
}
public void show(WindowEvent event) {
Browser browser = (Browser)event.widget;
final Shell shell = browser.getShell();
if (event.location != null) shell.setLocation(event.location);
if (event.size != null) {
Point size = event.size;
shell.setSize(shell.computeSize(size.x, size.y));
}
shell.open();
}
});
browser.addCloseWindowListener(new CloseWindowListener() {
public void close(WindowEvent event) {
Browser browser = (Browser)event.widget;
Shell shell = browser.getShell();
shell.close();
}
});
}
}

Grant


"Oliver Lee" <oliver.rcp@gmail.com> wrote in message
news:hbrssg$l78$1@build.eclipse.org...
> hi,every one!
>
> i use OS.setParent etc..API to embed some ie windows to my swt
> application,but when one of the IE window execute window.open function of
> javascript,other ie window's process will be killed and cause these ie
> windows disappeared. Microsoft acknowledged
> that is IE's bug,any one know about that?any way to solve?
>
> thanks a lot!!
>
>
Previous Topic:Editable Text to fill scrolled composite, but not expand it?
Next Topic:is swt(draw2d) suitable for cad software development?
Goto Forum:
  


Current Time: Sat Aug 24 23:32:16 GMT 2019

Powered by FUDForum. Page generated in 0.01592 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top