WKWebView | OSX Swift 3 Demo App to show web content | iOS library
kandi X-RAY | WKWebView Summary
kandi X-RAY | WKWebView Summary
OSX Swift 5 demo app to show web content in a WkWebView with WebKit. The present OS X Swift Class is related to the medical project RadioLogic. The program has been developed and documented for my own needs. I think it may be of interest to other developers. For this reason I made it available as a public GitHub. If you find it useful, you are welcome. Additional Informations are available in the project Wiki.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of WKWebView
WKWebView Key Features
WKWebView Examples and Code Snippets
Community Discussions
Trending Discussions on WKWebView
QUESTION
In my SwiftUI App, i used a WKWebView to update some html tags from native side, using SwiftUI TextFields. To get the communication working, i am using the evaluateJavaScript()
method to send data from native to webview.
My code looks like this:
...ANSWER
Answered 2022-Jan-10 at 19:34This looks like Apple's defect, because updateUIView is called, but evaluateJavaScript
(internal JavaScript) generates exception, because bridge.onMessage is lost and not a function more.
Here is found work-around - reset WebView on scene activation (app comes into foreground), as it recreated with current states the previous values are preserved. Tested with Xcode 13.2 / iOS 15.2
QUESTION
I'm sending push notification's with OneSignal, I'm receiving them fine. My problem is, is that when I click on the notification, I'd like it to open the notification url. I have the notificationUrl, but loading the url in my WKWebView is my problem. I am using SwiftUi App lifecycle, and not UiKit. So take in note that I don't have a ViewController.
I've tried using UIApplication.shared.open(URL(string: notificationUrl)!)
but this opens the link in the browser.
Here's my notification opened handler in AppDelegate.
...ANSWER
Answered 2021-Dec-15 at 16:32What worked for me, is to make the webview variable a global variable in the code. So in WebView.swift or your webview file, put the WKWebView
variable on the outside of the struct and apply:
QUESTION
I am trying to work with a WKWebView in swift and currently have a download engine using AlamoFire. I have run into a site that uses the blob: url scheme to download items. Is there a way to download blob files using AlamoFire or WKWebView in general?
My specific goal is to download the content from this blob URI to a file.
I would appreciate any help. Thank you.
All relevant code is attached below.
Here's the URL I was having a problem with:
...ANSWER
Answered 2021-Dec-14 at 19:59After a few days, I was able to figure out how to download a blob URL without WKDownloadDelegate. The following code builds upon this answer.
A message handler needs to be created to respond to JS messages. I created this in the makeUIView
function
QUESTION
I have a php file on the server that generates a file to download when I access to it via any web browser, even with safari.
...ANSWER
Answered 2021-Nov-15 at 19:39From iOS 14.5 you can use WKDownloadDelegate
to download attached files in responses and can provide a destination url to save:
QUESTION
I am totally new to Swift and I just need a webview app of my website. Everything seems fine except the external links such as "tel", "mailto", or "whatsapp". When I click them, nothing happens. I have searched many related titles and tried many things but the links are still not working. The last thing I tried is below. Can anyone help?
...ANSWER
Answered 2021-Nov-18 at 18:20Try intercepting requests on WKWebView implementing decidePolicyFor navigationAction
:
QUESTION
I created WKWebView that doesn't have one url. User use this WKWebView as Safari means user can search anything on WKWebView. I am facing one issue when I change dark and light mode my web view will show me only white(Light) mode. My app is working on both mode all things working fine except WKWebView.
Already search on SO not find any related question on this. how to use iOS 13 darkmode for wkwebview
I refer this blog but it's static url so it will not help me out
https://useyourloaf.com/blog/using-dynamic-type-with-web-views/
Also checked opaque and background property but not working for me!
IMPORTANT User can search anything like google.com, photos or any surfing etc.
...ANSWER
Answered 2021-Nov-08 at 11:22You can use injecting CSS technic to add Light/Dark feature to your loaded web pages e.g:
QUESTION
I have a macOS web browser made using SwiftUI and WebKitView that works well with most sites but some pages such as WhatsApp i get the following error message to upgrade to a newer version of safari.
WebView
...ANSWER
Answered 2021-Sep-21 at 13:27First of all you can use Safari Services instead of WKWebView, so you will be actually using a compatible browser.
Otherwise, it depends how the site checks the browser it's loaded in.
The most primitive way to check the browser type and version, is to look at browser's user agent string. For cases like this, you may be able to surpass the check by setting a customUserAgent on WKWebView to whatever the site supports. It's a hack though, as your WKWebView pretends to be a different browser.
More sophisticated cases check not the actual browser, but the capabilities they need. For example the site may check if cookies, or local storage is enabled. In this case you should just enable the required capabilities on your WKWebView.
In third case, site tries to explicitly block embedding its content into WKWebView or WebView. In that case you have to respect the site owner wishes, and not try to embed the site.
Which one is the case of WhatsApp, not quite sure. You will have to experiment I guess.
QUESTION
EDIT: While i was trying the same solutions that I already tried, I got it working with "cordova.file.documentsDirectory", it must be something that I missed last week
ORIGINAL QUESTION:
I'm building a Leaflet map app in Cordova 9.0.0 that needs to be able to download, unzip, delete unzip file and then access images from unzipped directory on mobile device for offline use.
I'm using Cordova File, FileTransfer and Zip plugins and application works as expected on the Android device, but not on iOS(using cordova platform iOS 6.2.0).
I've tested it on iPhone 5s(iOS 12.5.4) device, iPhone 8(iOS 14.5) simulator, iPhone 11(iOS 14.5) simulator in Xcode and I can successfully download, unzip, delete zip file and then access map tiles through
cordova.file.tempDirectory+"name_of_unziped_directory/"
or
cordova.file.applicationStorageDirectory+'Documents/name_of_unziped_directory/'
(documentsDirectory) or cordova.file.documentsDirectory+'name_of_unziped_directory/'
while offline, but when it comes to testing it on iPhone 11(iOS 14.7.1) device I can download, unzip and delete the file but cannot access map tiles and I get error:
Failed to load resource: The requested URL file:///private/var/mobile/Containers/Data/Application//tmp/unzip_directory/zoom/x_coord/y_coord/image.png was not found on this server
I'm trying to access map tiles like this(in this case we are accessing through documentsDirectory, but It gives the same results if I change the path as I mentioned above):
...ANSWER
Answered 2021-Aug-23 at 13:37I had the same problem with the new releases of ios. As far as I can remember window.WkWebView.convertFilePath([your file path]);
isn't enough and I can't provide an exact solution but what I ended up doing was:
QUESTION
Our flutter app uses webview to give users access to our online retail store. This retails store uses cookies.
This hasn’t been a problem until this week. As of last week, Apple started rejecting our updates because the webview section of the app uses cookies.
We would like to configure the webview widget to block all web cookies by default.
We’re using the webview_flutter widget, which uses WKWebView for iOS under the hood.
Is there a way to automatically block all web cookies via the webview?
...ANSWER
Answered 2021-Sep-27 at 06:29There is a way to clear the cookies:
QUESTION
Right after the splash screen fades out, the app is stuck on a blank page leaving this error in the console (ProxyWeb::didFailProvisionalLoadForFrame)
Note that the same app works perfectly on all previous IOS versions. I tried to change the webview plugin version, cordova-ios, and played around with angular build process but no luck.
I suspect that the angular portion of the project does not initialize, cordova itself loads successfully but anything beyond that is just an empty blank screen.
...ANSWER
Answered 2021-Sep-24 at 12:03Problem solved by a colleague, turned out a few providers (DatePipe, Location, Market, InAppBrowser) in app.component.ts
and a router animation were causing the fuss.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install WKWebView
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page