In my application i want to change default webview browser
XAML
<WebView x:Name="webView" Grid.Row="1" Navigated="webView_Navigated">
</WebView>
C#
WebView web = new WebView()
{
Source = res.url,
};
webView.Source = web.Source;
When i am trying using like this facing issue with google authentication
error :
this browser or app may not be secure.
How can I resolve this issue ?
The message "this browser or app may not be secure." is not caused by the web view. You need to check the URL and the configuration.
Addressing the original question WebView is not very configurable. Xamarin Essentials have "Browser" but it is even less.
If you want to have more control over the web renderer you need to approach the problem with custom renderer using WebKit (for Android) and UIWebView (for iOS) controls.
Related
I'm building an application on Nativescript-vue where I'm using webview to play HTML5 video player in it. I want this video player to go fullscreen but I'm to able to see any controls, I did some research and I came to know that it I need to give permission for fullscreen.
<WebView #loaded="onWebViewLoaded($event)" :src="url_to_be_fetched" />
In my webview I required local storage access also which I overcome by:
onWebViewLoaded(args) {
console.log('check on load');
const webView = args.object;
if (webView.android) {
webView.android.getSettings().setDomStorageEnabled(true);
webView.android.getSettings().setDatabaseEnabled(true);
}
},
I came across the same issue but with angular AllowFullScreen in webview nativescript (angular)
I'm not sure how to implement in my vue app. I'm sure there must be some way out to it. Help me out, Thanks.
I am currently using a web view to load some urls,I client reported that when clicking on an item on my menu and the webview is triggered and goes to one of their pages the video they have embedded on their page does not play.
Am I missing something basic here? eg permissions or is it a limitation of the webview?
also one of their links uses "#whatever" at the end and is meant to scrolldown and loading the page, but does not work. Is this supported?
many thanks
I am working on a simple app written in Nativescript.
The app has a login form that authenticates against an API, and on success loads a webview. So not that complicated.
But I would like to be able to open certain links in the default browser on the phone, and not in webview, like links to external sites.
Is it possible to "capture" all link clicks, and if the link has the target attribute set to blank, we make the link open in a external browser?
I need a solution that works both on iOS and Android.
Is this possible to do in Nativescript?
Yes, it's possible to do that in NativeScript but not with the default WebView component. I was exactly in this situation, what I did is writing a plugin that customizes default WebView in NativeScript to override the default WKUIDelegate in iOS webview & idem for Android.
For iOS, the WKUIDelegate allow to detect if any attempt to open link with target _blank with method webViewCreateWebViewWithConfigurationForNavigationActionWindowFeatures, hence, when implementing your custom webview with this delegate allow to open link in external browser / application as you wish.
Take a look at this plugin: https://github.com/Notalib/nativescript-webview-ext to have an idea how to customize default webview.
You may use the nativescript-webview-ext plugin and use the shouldOverrideUrlLoading event to check the URL and cancel the process as needed then use the open url method in utility module to open the given url in default browser.
You can import this
import * as utils from "#nativescript/core/utils";
and then do
utils.openUrl("https://www.youtube.com/");
whenever you want to open a link (in this case youtube) in a default browser.
I am using xamarin.forms mvvm light architecture and targeting Android & iOS.
I am currently writing custom renderer for navigation drawer(MasterDetailPage).
I am currently writing custom renderer for Android and i have tried many things.
Currently my MasterDetail Page renders according to OS's default behaviour i.e. in Android master page starts below the app bar but i wanted my master page to popover app bar or start above the app bar like gmail,stack exchange android app etc
use this theme Theme.AppCompat.Light.NoActionBar for the expected behaviour
There exists one already, as of this writing it is out of date though (not targeting Xamarin Forms 2): https://github.com/nativecode-dev/oss-xamarin. Perhaps you can use that?
I have a basic webview:
<WebView x:Name="webView1" Grid.Row="1" Margin="75,0,40,40"/>
The code behind is as follows:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
webView1.Navigate(new Uri("http://www.bbc.co.uk/news"));
}
The webview displays, but it does not scroll or allow you to click on any of the links (basically no interaction with in the BBC website).
I have made a completely blank test project and stuck this in the page to test it, but it works fine. So there is clearly an issue with my real project.
I have compared the manifest settings of my project and the working test project, but they appear the same.
Would there be some security setting somewhere? I can't see why my project would handle the webview differently to the test project.
After finding a similar question, WebView “disabled” in Windows 8.1, I went back to my project to see if I had any transparent layers over the top of my webview, preventing the interaction.
I looked at the visual tree using XAML Spy software. There was nothing there. I then realised that XAML Spy itself was there! So I disabled XAML Spy in the project, and the webview now works!
So XAML Spy must put a transparent layer over the top of your application, which obviously prevents webview interaction. I will log that as a bug with XAML Spy. Hopefully they will be able to fix it.