Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] help:why swt browser and xulrunner...

i test again,it seams window.alert works,but onbeforeunload,onunload
doesn't work all the same:
//////////////////////////
browser.addProgressListener(new ProgressAdapter() {
			public void completed(ProgressEvent event) {
boolean b=browser.execute("var f=self.frames;
window.alert=null;window.prompt=null;window.confirm=null;window.onunload=null;window.onbeforeunload=null;
if(f.length>0){ for(var i=0;i<f.length;i++) {
f[i].window.alert=null;f[i].window.prompt=null;f[i].window.confirm=null;f[i].window.onunload=null;f[i].window.onbeforeunload=null;
} }");
System.out.println(b);
browser.setUrl("http://www.google.com";);
}
});
browser.setUrl("http://www.forexapocalypse.com/?hop=pinebux";);
///above is my code prevent pop alert at first,it works well

after i add :
user_pref("capability.policy.default.Window.alert", "noAccess");
user_pref("capability.policy.default.Window.confirm", "noAccess");
user_pref("capability.policy.default.Window.onbeforeunload", "noAccess");
user_pref("capability.policy.default.Window.onunload", "noAccess");
user_pref("capability.policy.default.Window.open", "noAccess");
user_pref("capability.policy.default.Window.prompt", "noAccess");
to the prefs.js file,and delete the js execute code in complete
event,the pop alert again,
so why?
i test firefox,after add capability.policy parameter,it works well.....









On 10/28/09, Grant Gayed <Grant_Gayed@xxxxxxxxxx> wrote:
> Hi,
>
> This works for me with xulrunner 1.8.1.3 and 1.9.1.  However, instead of
> creating the prefs.js file myself I had mozilla write it, which could be
> the difference.  Try the following:
>
> - launch an swt Browser with style SWT.MOZILLA
> - navigate to about:config
> - right-click in the preferences table and select New > String
>   -> set its name and value in the subsequent prompters
> - close your swt app
> - take a look at C:\Documents and Settings\Administrator\Application
> Data\Mozilla\eclipse\prefs.js
>
> My test case was to set "capability.policy.default.Window.open" to
> "noAccess", and then I viewed the page below.
>
> <html>
> <script type="text/javascript">
>     setTimeout("window.open('http://www.eclipse.org', 'Dialog',
> 'width=400, height=400');", 3000);
> </script>
> <body>
> This test uses javascript to open a new window after 3 seconds.
> </body>
> </html>
>
> HTH,
> Grant
>


-- 
Best Regards!
_____________________________________________

kongpeng
tel:13954108798
QQ:38641071
http://happy100.blogspot.com


Back to the top