Close Browser Window opened by GotoURL

MagarG

MagarG

VIP Member
We have an application that opens an imaging system document using the Go To URL function. We would like to close the window when done with processing. Is there anyway to close this window in the event rules?
 
It used to be possible to "pass" a html code (incl. a script) via Text Block Control, however in 9.0 it does not seem to be allowed anymore (I just tried). You may try other controls trying to pass
<font class="small">Code:</font><hr /><pre><script>window.close();</script></pre><hr />
through some parameter of a control but I doubt you would succeed. If you do, please let us know...
 
There is a new security feature in 9.0 that by default prevents HTML and scripting in text block controls. You can override this functionality in the Security Workbench Text Block Control security by setting the Application Encoding option to No.

As David mentions, you can then open and close your window using the window.open() and window.close() JavaScript methods, eg:

<font class="small">Code:</font><hr /><pre><script type="text/javascript">
mywindow = window.open("http://www.google.com", "mywindow", "location=1,status=1,scrollbars=1, width=100,height=100");
mywindow.close();
</script></pre><hr />

Embed some code along these lines into the text block control using the Add Segment system function.

The method that we generally use is to create JavaScript functions (eg: openURLwindow, closeURLwindow) to perform the open and close and add these to a text block control at the top of the form. Do this in Post Dialog is Initialized. And then when you want to execute one of these functions add the following to another text block control:

<font class="small">Code:</font><hr /><pre><img src="/jde/share/images/spacer.gif" onload="openURLwindow('www.google.com')"> </pre><hr />
 
Thanks for the replies!

I was messing around with this but not sure it can be done. Current method is a Grid with and Invoice Number. User selects a grid row, the event rules for the Select button launch then using this:

VA form_URLLink = concat("http://imageserver/webserv/url.do?getimage&Invoice_Number=",[GC InvoiceNumber])
Go To URL(VA formURLLink)

This launches a new window and displays the scanned document.


I was trying to change this to some kind of window.open method but can't get it to work. I got the openURLwindow function in a Text Control Box but I don't think it's possible to call it from the event rules passing in the invoice number dynamically.
 
You'll need to build up an HTML string in a variable containing the following text, and then add it to a second text block control (which, on the form, is below the one containing the function):

<img src="/jde/share/images/spacer.gif" onload="openURLwindow('http://imageserver/webserv/url.do?getimage&Invoice_Number=123456')">

The dummy spacer image is used to ensure that the JavaScript runs immediate the HTML is added to the text block control.
 
Back
Top