protected override void AssingViews() { buttonBack.TouchUpInside += (o, e) => { if (WebviewContainer.CanGoBack) { WebviewContainer.GoBack(); } else { presenter.CloseClicked(); } }; var websiteDataTypes = new NSSet <NSString>(new[] { //Choose which ones you want to remove WKWebsiteDataType.Cookies, //WKWebsiteDataType.DiskCache, //WKWebsiteDataType.IndexedDBDatabases, //WKWebsiteDataType.LocalStorage, //WKWebsiteDataType.MemoryCache, //WKWebsiteDataType.OfflineWebApplicationCache, WKWebsiteDataType.SessionStorage, //WKWebsiteDataType.WebSQLDatabases }); WKWebsiteDataStore.DefaultDataStore.FetchDataRecordsOfTypes(websiteDataTypes, (NSArray records) => { for (nuint i = 0; i < records.Count; i++) { var record = records.GetItem <WKWebsiteDataRecord>(i); WKWebsiteDataStore.DefaultDataStore.RemoveDataOfTypes(record.DataTypes, new[] { record }, () => { Console.Write($"deleted: {record.DisplayName}"); }); } }); WebviewContainer.NavigationDelegate = new MyWKNavigationDelegate(this); }
public void OpenUrl(string url) { WebviewContainer.LoadRequest(new NSUrlRequest(new NSUrl(url))); }
public WebViewerView(BrowserType type, IBrowserParentPage parentPage = null, bool withTopMargin = false, bool isExternal = false, Orientation orientation = Orientation.Portrait, bool fullScreen = false, bool showTitlePanel = true) { InitializeComponent(); this.Orientation = orientation; if (Device.RuntimePlatform == Device.iOS) { Browser = new WebViewer(orientation, fullScreen) { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; slWebContainer.Children.Add(Browser); } else { var container = new WebviewContainer() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, }; container.WebViewer = new WebViewer(orientation, fullScreen); Browser = container.WebViewer; slWebContainer.Children.Add(container); } Browser.BrowserType = type; Browser.ParentPage = parentPage; Browser.IsExternal = isExternal; Browser.PropertyChanged += Browser_PropertyChanged; if (withTopMargin && Device.RuntimePlatform == Device.iOS) { Content.Margin = new Thickness(0, 20, 0, 0); } BindingContext = this; var tapGesture = new TapGestureRecognizer() { NumberOfTapsRequired = 2 }; lblTitle.GestureRecognizers.Add(tapGesture); lblTitleView.GestureRecognizers.Add(tapGesture); tapGesture.Tapped += TapGesture_Tapped; // this.OnTitleTripleTapped += () => AppContentPage.Instance.WVTitleTripleClicked(this); // var tapGesture2= new TapGestureRecognizer(); // lblTitle.GestureRecognizers.Add(tapGesture2); // lblTitleView.GestureRecognizers.Add(tapGesture2); // tapGesture2.Tapped += TapGesture_Tapped1; ; if (!showTitlePanel) { rd0.Height = 0; lblTitleView.IsVisible = false; } }