guyr
06-01-2007, 01:03 AM
I'm using OL4 to target the DHTML runtime. From a JSP page, I open a new window to run the OL4 application. When a button is clicked in the OL4 application, I need to change the displayed page back in the original window. By trial and error, I found the way to do this is top.opener.location.ref="new-url".
Here is my handler function for the button:
<handler name="onclick">
// Debug.write("href: " + this.href);
// changeSccWindow(href);
// LzBrowser.loadJS("top.opener.location.href='" + href + "';");
// LzBrowser.loadJS("top.opener.location.href='" + href + "';top.opener.focus();");
// top.opener.location.href="/scc/html/index.jsp";
// top.opener.focus();
</handler>
And here is the <script> block on the canvas:
<script>
<![CDATA[
function changeSccWindow(href)
{
// Debug.write("href: " + href);
// alert(href);
// LzBrowser.loadJS("window.opener.location.href=" + href);
// top.opener.location.href="/scc/html/index.jsp";
// top.opener.focus();
}
]]>
</script>
I did a lot of trial and error, which is why so much is commented out. Briefly, I discovered that LzBrowser.loadJS() works fine for Firefox for both DHTML and Flash 8 runtimes; for IE7, it only works for Flash 8.
If I uncomment the call to changeSccWindow() and the alert and top.opener calls inside that function, DHTML works for for Firefox. For IE7, nothing happens, so I'm guessing that the function is not getting called. No errors are being generated.
Now if I comment everything back out, and uncomment the two top.opener statements in the handler, both Firefox and IE7 work. This seems to confirm that the <script> function is not getting invoked under IE7. Any ideas?
Any alternative way to accomplish the task that will work under both runtimes and both browsers? Thanks. For anyone interested, top.opener.focus() does not work under either browser if you are using tabs. I spent a couple hours searching the net, and apparently this is by design.
Here is my handler function for the button:
<handler name="onclick">
// Debug.write("href: " + this.href);
// changeSccWindow(href);
// LzBrowser.loadJS("top.opener.location.href='" + href + "';");
// LzBrowser.loadJS("top.opener.location.href='" + href + "';top.opener.focus();");
// top.opener.location.href="/scc/html/index.jsp";
// top.opener.focus();
</handler>
And here is the <script> block on the canvas:
<script>
<![CDATA[
function changeSccWindow(href)
{
// Debug.write("href: " + href);
// alert(href);
// LzBrowser.loadJS("window.opener.location.href=" + href);
// top.opener.location.href="/scc/html/index.jsp";
// top.opener.focus();
}
]]>
</script>
I did a lot of trial and error, which is why so much is commented out. Briefly, I discovered that LzBrowser.loadJS() works fine for Firefox for both DHTML and Flash 8 runtimes; for IE7, it only works for Flash 8.
If I uncomment the call to changeSccWindow() and the alert and top.opener calls inside that function, DHTML works for for Firefox. For IE7, nothing happens, so I'm guessing that the function is not getting called. No errors are being generated.
Now if I comment everything back out, and uncomment the two top.opener statements in the handler, both Firefox and IE7 work. This seems to confirm that the <script> function is not getting invoked under IE7. Any ideas?
Any alternative way to accomplish the task that will work under both runtimes and both browsers? Thanks. For anyone interested, top.opener.focus() does not work under either browser if you are using tabs. I spent a couple hours searching the net, and apparently this is by design.