I have a CodeName One app where I'm using the BrowserComponent to load an HTML page. This HTML page (HTMLPage1) further opens another HTML page (HTMLPage2) on the click of a button using window.open(). This works correctly in the app. This HTMLPage2 has a Close button and on clicking this button, HTMLPage2 should be closed and the control should go back to HTMLPage1. However, this is not working as expected. On clicking the Close button, nothing happens in the app and HTMLPage2 is still shown in the app. I have tried using window.close() and self.close() and neither of them work.
I found the following article on searching
Android Webview: Scripts may close only the windows that were opened by it that seems similar to the problem I am facing
Also, I have a WebView Test app (can be found on PlayStore - search for com.snc.test.WebView Test) on my mobile that lets me modify the WebView settings and launch different URL's. I used this app to check if I can successfully invoke my HTML pages through the WebView Test app. With the default settings, I ran into the same problem as described above. The Close button didn't work.
However, then I modified the setSupportMultipleWindows() property in the app and set it to true. After that, it worked correctly through the WebView Test app. On clicking Close in HTMLPage2, that page was closed and I could see HTMLPage1 again.
So, I tried checking how to set this property in CodeName One. I found that the BrowserComponent.setProperty("SupportMultipleWindows", "true") should be able to do the same thing. When I set this property and tested the app, it still didn't work.
Then I looked through the documentation of
WebSettings.setSupportMultipleWindows
According to this documentation, if set to true, WebChromeClient.onCreateWindow(WebView, boolean, boolean, Message) must be implemented by the host application.
I could not find a way to do this through CodeName One.
Am I going down the right path to tackle this problem? If not, kindly guide me.
Related
I am getting a behavior which I am not sure of how to explain. An application has a deep link with a custom scheme data block in the activity's intent filter. A link click in a web page is responsible for delivering the intent.
Now, this works as intended but only the first time!
Specifically in Android 7 and 8 (older versions seem fine) after the first time the link is clicked instead of the app activity showing, a link of the format scheme://host/file.html?url=[link to asp file containing the intent function] is loaded with the header and footer of the web page but no contents (nothing there anyway). If the page is refreshed (button or transition back to it from another page) the link works properly but only once. Need to refresh each time it has been used for it to work again.
I tested the behavior with multiple browsers and it seems to be the same. I am guessing it has something to do with a behavior change in the newer versions of Android (???) but I cannot seem to find what is causing it and whether it is an app (hard), system (probably) or browser (could be?) related issue and as a result a possible solution.
If you think there is any information that might help let me know and I will try to provide it.
Thank you.
I have a phonegap app where I'm using the phonegap-ios-template to start it off, and I've redirected the app to open a website, say https://google.com
When I click on any link inside the app, it opens in a new browser window, as opposed to staying in the app. (i.e. there is a second screen that looks like a browser, has 'back to sampleapp' in upper lefthand corner, looks like a new session)
I'm trying to prevent this as I have a sample ios app which doesn't do this (it's just a single wkwebview, and I can navigate inside the app).
Found my own answer!
Started here:
https://forums.adobe.com/message/8647991#8647991
Realized that all links were being requested to open in a browser, so following the advice of the forum user, I just removed the two <allow-intent> http lines and voila it worked!
Additional reference here:
https://github.com/phonegap/build/issues/508
I want to show selected results from within a facebook group in my app but I cant seem to figure out how to do that. I have tried playing with "fb://group/{id}" intent with no success. It opens the group page in facebook app but if I try adding some extra parameters e.g "fb://group/{id}/search/?query=some_text" it starts the facebook app on its home screen. I assume this is because the uri is malformed. But I don't see any other method. There is a supported uri for search i.e "fb://search" but I cant seem to find any information about it.
The only way I know how to do it is to open the app, go into the menu, at at the very bottom in small letters it says View Desktop Site (or something to that effect). It doesn't even look like a link - but it is - and it will open the full version of FB in your browser. Then you can navigate as normal (including search). Hope this helps!
I'm having this little issue with PhoneGap when playing around with it:
Whenever I open an external link on my iPhone, it goes fullscreen and there is no way back but terminate the app and start again. I've read some articles and think this could be easily fixed by just calling window.open (or navigator.app.loadUrl on Android).
However, the problem continues with 3rd party library. In particular, I'm using Google Maps and the widget has little links to "Terms of Use" and something else. Tapping this link will load the Google URL full screen again.
My question is, is there any global configuration/code to either modify the in-app web browser (add header, back button and so on) or open every external links on device's default browser?
Thanks for reading and helping :)
First you study about InAppBrowser.
InAppBrowser open with close(done) button . This is not working means you also use ChildBrowser.
Reference 1
Reference 2
I created a WebView (with JavaScript enabled) in my app to display a link programmatically. I send the url to it, and it loads. I do the same thing, instead sending it programmatically to a browser on the phone.
These look like the first picture.
The problem is the page displayed in both of these cases is different than if I copy and paste the link (generated in the app from the Log) to the same browser on the device manually, or open it on my desktop browser. These look like second picture.
A sample link is:
http://lyrics.wikia.com/index.php?title=Future:Karate+Chop+%28Remix%29&action=edit
Why could this be?
Sounds like you need to override the shouldOverrideUrlLoading in your WebViewClient, which should be attached to your webview, also in the overriden method it should return false if you want your webview to handle it.
The second thing I would recommend would be to also change the UserAgent that is being attached to your WebVIew as well since you're seeing a difference in Desktop/Mobile version of the website.
You can learn more about tweaking the user agent here:
Want to load desktop version in my webview using uastring