How to display a web content


Danny Cheah

Hi David, 

I would like to know how do the following. Can you guide me which sample to refer to that can achieve my objective below. 

  1. 1. I have a URL link that I would like to display on AB (https://asianbeacon.org/meet-my-mate/)
  2. I want to display as "Meet My Mate" and then the user will click on it and it will show the content of the URL to the user. 

Hope to hear from you soon. 

Thanks. 


Thank you.
Best regards,
Danny Cheah

decsoft

Hello Danny,

We can talking here about two different things. You can try to put the URL inside an IFrame control, so you really see the external website inside an app view. This approach can be taken with caution, since the external website can disallow to be placed inside an IFrame control, or may they don't appear like we can expect.

The other way is to place a button or any other control and use the "OpenWindow" action to open the URL in another browser or "webview". If your target platform include some of the Apache Cordova supported, you can check the "Browser" plugin in App Options -> Cordova -> Plugins, so the "OpenWindow" action open the URL in an "in app browser" or in the system browser if you like (see the OpenWindow action help).

One thing to be noted is that we can't just use an HTML link in order to open the URL, because this cause that the user go out of the app scope, and, if they back to the app, what happen is that the app is started again. So we need to catch this kind of links in order to use the "OpenWindow" action, like I refer above.

P.S. For Cordova platforms like Android, in my honest opinion, the best is to use the "OpenWindow" action with the "_system" argument. Remember that the Cordova "Browser" plugin must be checked in the app options. Doing this the URL is opened in the system's browser, the preferred by the user to see web pages: I think it's better than using the "in app browser" option, even when this can be useful in some scenarios, of course.



Danny Cheah

Hi David, 

Thank you so much for your suggestion. I will look at it tonight. Thanks again for your prompt reply. 


Thank you.
Best regards,
Danny Cheah

decsoft

You're welcome Danny!



Danny Cheah

Hello David, 

I managed to use Cordova Browser to present my URL. It works perfectly but with one minor problem. It occupies the entire screena and I would like to place a push button to go back to the previous screen. How can I contain the URL to occupy to just a section of my screen so that my push button will appear at the bottom of the screen. 

I've tried using container and iFrame and it does not work as when the URL load it covers the entire screen. 

Thanks in advance for your help. 


Thank you.
Best regards,
Danny Cheah

decsoft

Hello Danny,

The "in app browser" window of the Apache Cordova "Browser" plugin is shown in full screen, and, we can't do nothing about: the user must use the back button of the devices to get back to our app. I think we no need a back button here... since the user know what to do... use the back button of the device... this is my opinion, of course.

So the only way to do what you wanted is to show the external URL inside an IFrame control. Doing that we can certainly place the IFrame and the Push button that we wanted in the app's view. The problem here can be two, but in fact it's the same: the external URL can refuse to be shown inside an IFrame, and, on the other hand, maybe the contents of the external URL don't shown as we can expected inside the IFrame.

We can say that the IFrames can be useful to shown our own external contents, but not "any" website, since the problems referred above. I am not sure if one of these problems is what you get: I am not sure if the external URL that you try to show refuses to be shown in the IFrame (I remember that I try your URL, and it's works inside the IFrame).



Danny Cheah
Thanks David. Totally understand.
Thank you.
Best regards,
Danny Cheah

decsoft

You're welcome! :-)


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.