Reputation: 288
everyone, I have faced one problem:
The ZUL code:
<window title="Hello World!!" id="winMain" border="none" width="100%" height="100%">
<script type="text/javascript">
<![CDATA[
function testAlert() {
window.open ("http://cn.bing.com", "Show", "menubar=0,resizable=1,location=0,width=683,height=384");}
]]>
</script>
<div align="center">
<button id="btnShow" label="Show">
<attribute name="onClick">
<![CDATA[
Clients.evalJavaScript("testAlert()");
]]>
</attribute>
</button>
</div>
</window>
Function of the ZUL code is opening one new window in some browsers and it works well in CHROME, Firfox. But when I run it in IE8 , some error would arise :
client error: Failed to process script; Could not complete the operation due to error 80020101. (Error)
Is there some solution for this problem? Thank you very much !!!
Upvotes: 3
Views: 1137
Reputation: 2200
You can use Executions.getCurrent().sendRedirect(string, string)
javadocs to do this on server side. But for such a simple requirement you shouldn't need to go to server. Using ZK's client namespace you can call your testAlert() function on button onClick event on the client-side. Both approaches are shown in below code and it works on IE 8 (Standards mode)
<window title="Hello World!!" id="winMain" border="none" width="100%" height="100%" xmlns:w="client">
<script type="text/javascript">
<![CDATA[
function testAlert() {
window.open ("http://cn.bing.com", "Show", "menubar=0,resizable=1,location=0,width=683,height=384");}
]]>
</script>
<div align="center">
<button id="btnShow" label="Show 1">
<attribute name="onClick">
<![CDATA[
Executions.getCurrent().sendRedirect("http://cn.bing.com", "_blank");
]]>
</attribute>
</button>
<button id="btnShow2" label="Show 2" w:onClick="testAlert();">
</button>
</div>
</window>
Upvotes: 1