david_navigator Posted April 24, 2017 Share Posted April 24, 2017 I'm evaluating uniGUI at the moment and so far I'm very impressed. Couple of questions, hope they're not FAQ's, couldn't find answers in the forums.1. My app uses an embedded browser which pulls a web page from a uniGUI server. I'd like to set an http Server header so that the embedded browser can check that it's looking at my server. Am I correct in thinking that this is done through the UniServerModule.Title property and that it requires the registered version to change this ? 2. In my app, I'd like to detect when uniGUI has terminated. In the web browser this is displayed as the following;Web session terminated.Restart applicationbut looking at the source in a browser I just see the script that presumably outputs this. What is the best way for the embedded client browser to detect that the web session has terminated ? David Quote Link to comment Share on other sites More sharing options...
david_navigator Posted April 26, 2017 Author Share Posted April 26, 2017 No one any suggestions ?Do my questions not make sense ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 26, 2017 Share Posted April 26, 2017 Hi, Thank you for your interest in UniGUI! Can you give us more details? What is the embedded browser?! UniServerModule.Title property and that it requires the registered version to change this ? Yes, Best regards, Quote Link to comment Share on other sites More sharing options...
david_navigator Posted April 26, 2017 Author Share Posted April 26, 2017 I'm using FMX.WebBrowser.TWebBrowser.Basically I want to present my users with an app that they can download from the Android Playstore or Apple store. So I've built a delphi FMX app, which is little more than an embedded browser that points to the uniGUI server.This way they have an icon on their device, which when they click loads up the app which displays the uniGUI mobile page within the embedded web browser. (there's a bit more too it as the uniGUI app actually runs on their network so there is a config/connection (FMX controls) screen first).All this works well, but when they click on the "power button" in the uniGUI app, they get the message Web session terminated.Restart application. I want to detect this message and hide the browser and reshow my fmx connect screen. If the terminated message was just plain HTML then I could use the TwebBrowser methods to parse the HTML for the string and act on that, but because the page is generated from javascript, I have nothing to detect.So I'm just looking for something that the client browser can pickup on to realise that the session has ended - maybe a different http header field or even the title of the web page. For some reason I can't embed images - so screen shot one shows project as icon on desktop, screen shot 2 shows fmx config screen and screenshot 3 shows embedded browser displayed after user has clicked on connect button. screenshot 1 screenshot 2 screenshot 3 Quote Link to comment Share on other sites More sharing options...
david_navigator Posted April 27, 2017 Author Share Posted April 27, 2017 Did that help ? Quote Link to comment Share on other sites More sharing options...
GerhardV Posted April 28, 2017 Share Posted April 28, 2017 Not sure if this is what you are looking for but maybe have a look at the "OnSessionTimeout" event for TUniMainModule? Quote Link to comment Share on other sites More sharing options...
david_navigator Posted April 28, 2017 Author Share Posted April 28, 2017 I GerhardV, thanks, but it wasn't. However I've now discovered that the FMX browser doesn't allow the developer access to the source of the webpage, so the whole concept is void. In the end I've changed the ServrMessages.TerminateTemplate to <html> <head> <meta charset="UTF-8"> <meta http-equiv="refresh" content="0; url=http://0.0.0.0"> <script type="text/javascript"> window.location.href = "http://0.0.0.0" </script> <title>Page Redirection</title> </head> <body bgcolor="#dfe8f6"> <p style="text-align:center;color:#0000A0">[###message###]</p> <p style="text-align:center;color:#A05050"><a href="[###url###]">Restart application</a></p> </body> </html> which hopefully will automatically try and redirect the browser to illegal address 0.0.0.0 - this generates an error, which I can trap in the FMX.Webbrowser and use to hide the WebBrowser control and show my connection controls.Testing all seems to work.This gives me a PhoneGap kind of solution where the user thinks that they're running a native app, but really it's a web app. [don't think I need both the javascript and the meta refresh though] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.