question

Upvotes
Accepted
0 0 1 3

How to use JET request in a new window?

JET.navigate() is used in order to open a new window in a separate tab when clicking a button.

After the new window opens, i want to use JET.request() in order to retrieve some data.

The problem is that somehow, the connection to JET is lost and the AppInfo data is empty and I'm not able to make the request.

There is no error in the console. I have a message saying that JET is registered, but in the new window, appInfo is empty.

Any idea?

eikoneikon-app-studiojet
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
Accepted
39.2k 75 11 27

Issue is resolved by adding the following parameters to JET.navigate method

JET.navigate(
      "name" : "Web Host App",
      "url" : "URL of the page you navigate to”,
      "properties" : [
        {"ELAppId" : "App ID of your App Studio app"},
        {"ELAppProductName" : "App ID of your App Studio app"},
        {"ELAppTitle" : "App name of your App Studio app"},
        {"ELAppBrowserType" : "Chromium"},
        {"ELAppBrowserAffinity" : "Yes"}
      ]
)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
13k 32 12 18

@fasie, I assume the navigate is loading a resource in your local file system. In that case, the loaded resource has to reference and load JET scripts, before using the JET object. You can download the JET2 bundle as shown in the quick start.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
39.2k 75 11 27

@fasie
A new window that you open as a result of executing JET.navigate method is a new instance of Chromium browser. To use JET in the new instance of the browser you need to initialize JET by calling JET.init just like you initialize it the first time in your app.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

@Alex Putkov, here is how it works:

I have a MVC app. Two windows mean two views. In the first view i initialize JET, everything is ok, the AppInfo contains all the necessary info.

When I click the button which is supposed to open the new window (where JET is also being initialized), it opens the new window, in the console I receive the message "App container is registered with EikonJET", but the AppInfo data is empty.

The next step is to enter a RIC in a textbox and click a button to make the JET request. Here is where it stops working. There is no error.

EikonNow detected Eikon Desktop

App Container registered with EikonJET!

appId is null

Upvotes
0 0 1 3

Also, there is one thing that i noticed. If i run the app on the localhost, everything works well, I am able to make the JET request and receive data. The problem is on the published version of the application.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
39.2k 75 11 27

Is the HTML page loaded in the new window on the same domain as the main page? JET library has a concept of trust levels, which enable/disable some parts of its functionality. You have full trust when the URL is localhost. Similarly you have full trust when the domain is one of the App Studio registered URLs. But if the domain is not recognized, then AppInfo would be empty and the data requests from Eikon would be disabled.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

yes, it is the same domain.

Click below to post an Idea Post Idea