mappView landing page revision

Today I want to share with you my experience with a not often used feature of mappView: the landing page.

Help reference: be7948ef-7b28-4228-899a-04547e22ef94

What does this feature do?
This feature was designed to show a waiting page at system startup when mappView server is not ready yet.
Capture

When should it be used?
This can be usefull when your client system is faster than AR, as it prevents the client from showing an error page in the first seconds after a reboot.
In my personal use case, I was developing an application based on hypervisor with Linux as GPOS and it turns out that Linux was indeed faster than AR to boot. For this reason, I was experiencing that behavior at each restart of the system.

How it works?
This feature is basically a local HTML page called mappViewInit.html, which consists of a loading animation and a background polling process linked to your mappView visualization. This process detects when the visualization is ready and redirects you to it. What you have to do is configure your system to open that local page at startup inserting as URL arguments the ip address target and the visualization id.
Capture4

These two arguments are mandatory. Avoiding one of them results in this error:

My solution
Being forced to insert the visualization id is inconsistent with newer versions of mappView where, as you probably already know, you can set a default visualization and be able to open it without writing the visualization id in the URL.

Down here you can find a new version of mappViewInit.html which I’ve edited in order to make it works with or without visualization id.
mappViewInit.zip (1.7 KB)

Here an overview of the few easy changes I’ve introduced (new on the right):

The code is quite readable. On the bottom there is a control condition which prevents the execution of the script in case of some arguments lack. I’ve removed the condition which checks the visuId presence. On the top there is the creation of the redirect URL and there I’ve managed the two conditions with/without the visuId parameter.

Used versions:
AS 4.12.5.95
mappView 5.24.2

Hope this can help someone out there.

15 Likes

Thanks Andrea :slight_smile:

1 Like

Thanks for sharing. :heart:

1 Like

Hi community,
this update tries to address the problem related to the “sdm” parameter of the landing page. As you can easly find by reading the help page, this parameter doesn’t work anymore because the newer browser versions automatically block a feature which is required to make it work.

The solution

The original feature allows the user to see the SDM page inside the landing page, this is unfortunately not possible anymore (as far as I know). My solution is quite simple: to show a button which redirects to the SDM page. The button will be enabled only if the SDM can be opened, there is actually a function in the background which test if the SDM is available on the target.


There is still some issue…

The big issue with this solution is that once you have been redirected to the SDM page, the only way to go back to the landing page (and through it to the visualization) is with the back button of the browser, which usually is disabled on HMIs. It would be nice to find a solution to this, I’m open to suggestions. Due to this issue, to prevent unwanted behavior, a confirmation popup appears when the user presses the SDM button.

Differently from the first version, this update comes with a lot of changes in the code. If you don’t need this specific feature, maybe it would be better to keep using the first one.

Parameters

This solution requires to change the parameters list which now is the following:

Parameter Description Required
target IP address and mapp View server port (e.g. 127.0.0.1:81). Yes
visuId The ID of the HMI application. If this parameter is not provided, the default visualization will be applied. No
sdm_port The SDM port. If this parameter is not provided, the SDM feature will be disabled and the following parameter will not be ignored. No
sdm_mode The display mode for SDM visualization. Available options are: “iframe” which displays the SDM as originally designed by B&R (supported only on older browsers); “button” which displays a button that redirects to the SDM page. No

New version:

mappViewInit_V4.zip (2.3 KB)

Acknowledgments and recognition

The idea behind this update comes from @frank.zapf , who contacted me just after I’ve published the previous post. He told me that in Germany they had already addressed this issue with their own solution and gave me some hints to merge our two projects. The solution to test if the SDM is actually available on the target comes from @christoph.hilchenbac.

Thanks for your help.

3 Likes