Page 1 of 1

Retrieving Browser

Posted: Thu Mar 03, 2016 2:30 am
by Joerg Hamacher
Hi everybody,

how can I retrieve the browser in which the Web Page is running?
Many thanks in advance!
Joerg

Re: Retrieving Browser

Posted: Thu Mar 03, 2016 8:27 am
by Stewart Marshall
Hi Joerg

This information is available in the browser UserAgent string, accessible with a tiny bit of JavaScript in a widget.

http://www.w3schools.com/jsref/prop_nav_useragent.asp

We haven't made this available in VL because VL will manage browser differences for you. There shouldn't be a need for customers to manage it.

Is there a particular reason you need to distinguish between browser?

Regards

Re: Retrieving Browser

Posted: Thu Mar 03, 2016 8:47 am
by MarkD
Browser and browser version recognition is a very dodgy art.

One example - If your page ever gets displayed by one of the many Windows applications that use the Trident/MSHTML control - see https://en.wikipedia.org/wiki/Trident_(layout_engine) - then the agent string will tell you things that are not correct, such as you are running in IE7 when you are not.

Same with embedded pages rendered by email clients on iOS and Android devices, etc. There are a lot more browser variations/specializations and embedded rendering situations around that just the standard IE, Chrome, Firefox and Safari browsers.

Re: Retrieving Browser

Posted: Thu Mar 03, 2016 7:04 pm
by Joerg Hamacher
Hi Stewart,

thank you for your answer.
One of the reasons is the different behaviour of #SYS_WEB.Close: this only seems to work in IE or EDGE (window occurs and browser closes when clicking YES) , in Chrome the browser closes immediately without showing the window , in Firefox (44.0) nothing happens at all.

Best regards,
Joerg

Re: Retrieving Browser

Posted: Thu Mar 03, 2016 9:04 pm
by Jiri
#SYS_WEB.Close is a good example. If you have a Logout logic in your application, in browsers supporting this feature is best to close the winows after Logout logic is finished. In Firefox it is nasty, the best available solution is navigate back to a Logon screen.

Re: Retrieving Browser

Posted: Fri Mar 04, 2016 12:00 am
by Joerg Hamacher
Maybe it is better if I get more specifically...

We have a huge iSeries (5250) ERP system completely adapted for use in aXes.
Since all the logic is RPG / iSeries based we are in doubt what will happen if the users press typical browser buttons like "refresh", "back" or "close".
Database inconsistencies would be the consequence of such behaviour...

That's why we thougt to embed the aXes application into a web page (using "web page"-control) to keep control over the browser events.
We like to prevent the users from closing the application or refreshing pages by simply ignoring these browser events (that means: how can we explore which browser buttons and actions were fired and how can we react to this event?) and also prevent them from using aXes application with a firefox browser(that means: how can we detect the browser type and version?).

Best regards,
Joerg

Re: Retrieving Browser

Posted: Fri Mar 04, 2016 10:44 am
by Stewart Marshall
Hi Joerg

"We like to prevent the users from closing the application or refreshing pages"

In short, you can't. There is no realistic way of doing this. This is a very good thing indeed!! Most web site developers are good people, but there are a few whose motivations are less friendly. It's the same reason the local file system isn't available.

The #sys_web.CloseQuery event can be used to prompt the user when they try to navigate to another page, but they can still carry on after this if they want to.

You'd need a proper Windows application to achieve the level of control you're talking about, and even then Task Manager could still shut it down. And even if we use Windows security to prevent this, there's still the power socket on the wall.

The only practical solution is to make sure that the code executing on the server protects the database as best it can.


Regards