[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Opening an application URL  XML
Forum Index -> Development
Author Message
rpfautz

Active

Joined: 15/03/2017 17:03:05
Messages: 6
Offline

Hi Captain,

we need to open an application URL (like mailto:forum@captaincasa.com or vscode:extension/ms-azuretools.vscode-docker) automatically from the client.

So far we try it with with CLIENTJSMETHODCALLERNode with jsCall window.open(url). The problem is that independent of what argument like _self, _top we add or how we quote it always a new tab is opened.

Is there a way to prevent the new tab?


regards
Roger
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5521
Offline

Hi,

well, we do this internally as well (e.g. in our mailto-component...). I just checked the JS code there:

Code:
 RISCUtil.openURLAndClose = function(url,target) 
 {
     if (this.m_openURLCounter == null)
         this.m_openURLCounter = 0;
     this.m_openURLCounter++;
     if (target == null)
     {
         target = "windowtobeclosed"+this.m_openURLCounter;
     }
     if ("_self" != target)
     {
         var w = window.open(url,target);
         CCJSUtils.invokeFunctionWithDelay
         (
             function(pWindow)
             {
                 return function()
                 {
                     if (pWindow && pWindow.open && !pWindow.closed)         
                       pWindow.close();
                 };
             }(w)
             ,500
         );
     }
 };
 


The CCJSUtils.invokeFunctionWithDelay is some wrapping of setTimeout(...) coming from JavaScript.

So you see: open + close (with a delay of 500ms). We also use water for ccoking...

If there is some better solution: we are open to listen! ;-)

Kind regards! Björn

Björn Müller, CaptainCasa GmbH
rpfautz

Active

Joined: 15/03/2017 17:03:05
Messages: 6
Offline

Hi Captain,

the standard javascript implementation of this would be:
window.open("vscode:extension/ms-azuretools.vscode-docker", "_self");
This works perfectly when using plain html/js. But not with the RISC client.

But anyway it works fine with your util.
Thanks.


regards
Roger
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team