Xamarin Android - Load url in second webview - xamarin

Hi I wanted to load up a webview on android. And when a link is clicked in this webview to override the loading and have the link load in another webview. So I can display the first webview without having to reload the page.

You could do the following:
set a custom webview client on your webview
webView.SetWebViewClient(new MyWebviewClient(this));
In your webview client override ShouldInterceptRequest
In ShouldInterceptRequest method use the url parameter to create/show a new webview and then just return the current displayed data to prevent loading a new webview.

Related

Xamarin forms WebView not loading for specific url

Hi im using Xamarin forms webview and i had a specific url which is developed by my company when ever im loading the url the webview is returning empty screen can someone help me with this?
First of all the URLs must be fully formed with the protocol specified (i.e. it must have "http://" or "https://" prepended to it).
var browser = new WebView
{
Source = "http://xamarin.com"
};
Check your webview layout. Maybe is not have a good position in xaml.
For ios check NSAppTransportSecurity if the url is not https.
If you want open the browser tab inside your app check this
https://askxammy.com/customizing-browser-appearance-in-xamarin-forms/

How to know when WebView has refreshed due to JavaScript?

My webView has an HTML page with JavaScript that changes the appearance of the page when button is pressed in the HTML page. I can have the hosting program receive a callback through JavaScript when the button is pressed, and I can change values on the web page side of things. However, when these callbacks are made, the appearance change of the page has not yet changed:
WebViw is loaded and frameLoadDelegate is called
??? WebView is rendered and displayed
Customer clicks on the button, JavaScript `onClick' calls a JavaScript function which makes appearance changes, and then calls my Objective-C function.
Objective-C function checks appearance of WebView
??? WebView is rendered and displayed
In Apple's WebKit framwork, a WebView that has finished loading its resources sends a webView:didFinishLoadForFrame: message to its frameLoadDelegate. However, this only means that resources have been loaded, not that rendering is done… How can I detect that the WebView rendering is done? Among all the delegates of WebView, I couldn't find one that has the method I would need…

Ajax not working in CefSharp based WebView with local files

I have successfully embedded CefSharp in win form application using VS-2008 i am loading a jQueryMobile based webpage in webView which uses #id based ajax calls. which are not working in webView.
Is there any way to disable the security so i can load local files in the webview ?
got the answer by my self just needed a single line to do it
_browserSettings.FileAccessFromFileUrlsAllowed = true;

Background image on a page displayed in web browser control doesn't stretch/fit - Wp7

I'm building an app with a web browser control, which contains a mobile platform-customized page. The background image on that page should automatically fit to the window. And it does when visiting the URL in the ordinary browser. But when showing the page in the web browser control it doesn't fit the web browser window.
The web browser control matches the screen size. Scripts i set to allowed on the control. The WebView for android shows the page correctly.
I App.xaml.cs of your App you have to comment
//Application.Current.Host.Settings.EnableFrameRateCounter = true
//Application.Current.Host.Settings.EnableRedrawRegions = true
//Application.Current.Host.Settings.EnableCacheVisualization = true
And you will find this in public App().

Why Webview prevent showing a webpage when click a swf?

Now I show a swf from web in my webview , but when I click the url address in the swf to show another page with my default web browser, I found the webveiw prevent to do it , Why ? How to allow it ?Thank you very much!
You should look at the WebUIDelegate protocol, specifically this delegate method:
- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request;
If you've got an object registered as the WebView's UI delegate then this method is called when the Flash plug-in sends a URL change request. You can then do what you want with the request. By default, the WebView just ignores it.

Resources