Open Non editable url in a browser from activity in android - android

I can open a url from my app but i want to make that url non editable or to hide the url from the user. So that the user can't edit it(address bar - read only) or if that is not possible then hide the address bar from the user.

I used webview to display the webPage

Related

Android and custom URL scheme

I'm working on an app with a custom url scheme.
It is opening some webpage for authentication in a chrome tab. This is done in xamarin forms like this:
Browser.OpenAsync(apiUrl + "mobile", new BrowserLaunchOptions
{
LaunchMode = BrowserLaunchMode.SystemPreferred,
TitleMode = BrowserTitleMode.Hide,
});
everything work as expected if I return a webpage with a link and click the the link manually:
Click here to go the app
But if i return a 302 redirect to the same url it will not close the chrome tab and dont focus the app again.
If i add a javascript in the response, it will not automatically open the url (close the chrome tab and focus the app)
I've tried things like this:
window.location = url;
window.open(url,'_self');
setTimeout(()=>window.open(url,'_self'),10);
(url is a valid variable, even tried alert(url) after changing the location and it show the correct url.
Why does it only work when I click the link manually?
In order to maintain the user's security and experience, the browser prohibits the direct use of window.open(URL) in JS to open new links.
Try to change like below:
setTimeout(()=>window.open(url,'_self'),500); //The delay time must not be too short or you will be intercepted

How to show dialog when user clicks in a webview dialog

Currently, I have a WebView which opens my google drive pdf file which is encrypted (it has a password)
My project
it shows a dialog where I need to input a password,
now my problem is;
Is it possible to set a text in the input?
After the WebView retrieve the URL,
is it possible to set a text in the dialog?
thank you.

How to hide url in Chrome custom tab android

I have implemented new Chrome Custom Tab in android, I am using the following code to open
Uri uri = Uri.parse("https://akash.plobal.com/ploicy");
CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
intentBuilder.setToolbarColor(Color.BLACK);
intentBuilder.setShowTitle(true);
intentBuilder.build().launchUrl(getActivity(), uri);
I need to hide url below the title in toolbar
If you control both the content and the application, you can use Trusted Web Activities to completely remove the URL bar. You'll need to implement Digital Asset Links to validate the ownership of both.
If you don't own the content, it is not possible to hide the URL below the title. The URLs needs to visible to the user, so that they can know in which site they are. By removing this from the UI, a malicious site could mimic the UI of another one, and this could potentially create a security issue for users.
You cannot hide the url alone. You can only get rid of the whole title bar, that too when the user scroll the view. To achieve this,use
intentBuilder.enableUrlBarHiding();
You can try setShowTitle(false) of your custom tab.

How to get Webview 'url' from AccessibilityNodeInfo

Suppose ,I'm on the third party app say Amazon.
Now I'm able to access all of the window content using accessibility service and accessibility event type : typeViewFocused.
And I have a condition that if the window content contains class name android.webkit.WebView then I have to find the loaded URL for that Webview. But couldn't find the URL
, I can access all the content inside webview but I dont need the content of WebView I only need that URL which that webview used to load the content. Even I have checked all AccessibilityNodeInfo objects but not able to find URL

How to add a web address in a AlertBox as a link?

I am showing a Alertbox after clicking a button. The Alert box is customised one. Along with the Alert title it has to show a web address like http://www.google.com. While clicking the web it site has to load in a seperate Activity with the content of the specific address.I am using a webview and the website is loading successfully the problem is, not able to show the web address in alertbox. It will be better if i can show it as a link.
thanks and regards
Parvathi
String text = "<a href=http://www.google.de>Link zum klicken</a>";
builder.setMessage(Html.fromHtml(text));

Categories

Resources