LAMW - opening URL in external (default) browser stopped working in Android 11 lazarus / 43-Android ---------------------------------------------------------------------- Manlio · 2023-10-01 19:09 I made an app with LAMW with a button/link that opens a URL in the default browser. This worked fine in Android 9, but I just discovered that since Android 11, it doesn't work any more. The code which implemented opening the URL is this: Code: [Select]    jIntentManager1.SetAction(iaView);      jIntentManager1.SetDataUriAsString(url);     if jIntentManager1.ResolveActivity then         jIntentManager1.StartActivity(); Android 11 introduced new security requirements, which I researched and modified the manifest file to comply, but it still doesn't work. I'm attaching the manifest file. Any help will be greatly appreciated. ---------------------------------------------------------------------- c4p · 2023-10-01 20:44 I am testing this on Android 12, and this definitely works, you will of course require 'INTERNET' permission in the manifest too, which you have probably done already: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i jIntentMana ger1.SetAction('android.intent.action.VIEW');jIntentManager1.SetMimeTy pe('text/html');jIntentManager1.SetDataUriAsString('https://www.reuter s.com');jIntentManager1.StartActivity();   I will say that certain URLs, like Youtube.com will jump out their respectively installed app, so you may also want to set a Browser package so it forces to go to a specific URL rather than an installed default app to apply, entirely up to you though: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i jIntentManager1.SetPackage('com.brave.browser'); ---------------------------------------------------------------------- Manlio · 2023-10-02 01:20 Quote from: c4p on October 01, 2023, 10:44:54 pmI am testing this on Android 12, and this definitely works, you will of course require 'INTERNET' permission in the manifest too, which you have probably done already: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i jIntentMana ger1.SetAction('android.intent.action.VIEW');jIntentManager1.SetMimeTy pe('text/html');jIntentManager1.SetDataUriAsString('https://www.reuter s.com');jIntentManager1.StartActivity();   I tried the above (thank you!) and what happens is that the web page opens within my app - embedded in my app's current view. What I want however is to open the web page externally, in the default web browser, not within my app. Note: 1. I tried adding and tags to my manifest file, but I was not able to make it work - I'm probably doing it wrong. 2. If I call "if jIntentManager1.ResolveActivity then jIntentManager1.StartActivity() then nothing happens. 3. Could it be that I must do something in the manifest to ensure that ResolveActivity returns true? Something that complies with the new security requirements introduced with Android 11? And if not in the manifest, where? 4. It's ok if e.g. YouTube opens in some other way. I just want to open generic plain web pages in the default browser. I don't know which browser may be installed on the user's device. If I knew it, I guess I could call that. But then again, there must be a way to open generic web pages with the default browser... ---------------------------------------------------------------------- c4p · 2023-10-02 12:29 I would suggest using the code below in another button OnClick event, isolated from your code, to see if it works, it should open externally of the app in the default chrome browser. Change to whatever browser package you want it to open with, I would then troubleshoot why your code isn't working. Your manifest file looks OK to me, although guessing you're using an intent somewhere else for the phone state. Of course, I am testing on Android 12 but I wouldn't have thought there is that much difference between 11 and 12, I may need to check that, but try the below in an OnClick event of a button and see what happens? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i jIntentMana ger1.SetAction('android.intent.action.VIEW');jIntentManager1.SetMimeTy pe('text/html');jIntentManager1.SetDataUriAsString('https://www.reuter s.com');jIntentManager1.SetPackage('com.android.chrome');jIntentManage r1.StartActivity(); ---------------------------------------------------------------------- Manlio · 2023-10-03 15:26 I found that your code (in your first reply) works well on a physical device (Android 11) i.e. opens the default web browser in a separate app, but on virtual devices (Android Studio) it opens it embedded in the app itself. (But that's already major progress for me, so thanks again) After further research I found that this behaviour (opening in the app itself) is called Custom Tabs, and it looks like that's what happens in the emulators I used. https://android-developers.googleblog.com/2015/09/chrome-custom-tabs- smooth-transition.html I'll write here again when I make further progress. ---------------------------------------------------------------------- c4p · 2023-10-03 16:37 Ah, useful info, thanks for feeding that back.