wkwebview

SwiftUI - iOS 13 UIViewRepresentable of WKWebView gets Thread 1: EXC_BREAKPOINT crash

佐手、 提交于 2021-02-07 19:27:38
问题 I'm trying to port WKWebView over to SwiftUI. Here's my code: import SwiftUI import WebKit struct ContentView: View { var body: some View { WebViewWrapper() } } /** WKWebView ported over to SwiftUI with `UIViewRepresentable`. */ final class WebViewWrapper: UIViewRepresentable { /// `UIViewRepresentable` required function #1. func makeUIView(context: Context) -> WKWebView { print("make") let webView = WKWebView() /// EXC_BREAKPOINT error here return webView } /// `UIViewRepresentable` required

add download button for pdf in wkwebview in swift 4

喜欢而已 提交于 2021-02-07 13:41:26
问题 I have done webview app using wkwebiew in xcode 9. In the website, there are some part need to download the pdf file, the pdf file can be view only but how to make it can be download to our iphone. can you share some tip to me, this is my code class ViewController: UIViewController,WKNavigationDelegate,UIWebViewDelegate { @IBOutlet weak var activityIndicator: UIActivityIndicatorView! @IBOutlet weak var webView: WKWebView! @IBOutlet var containerView: UIView? = nil @IBOutlet weak var

add download button for pdf in wkwebview in swift 4

好久不见. 提交于 2021-02-07 13:38:23
问题 I have done webview app using wkwebiew in xcode 9. In the website, there are some part need to download the pdf file, the pdf file can be view only but how to make it can be download to our iphone. can you share some tip to me, this is my code class ViewController: UIViewController,WKNavigationDelegate,UIWebViewDelegate { @IBOutlet weak var activityIndicator: UIActivityIndicatorView! @IBOutlet weak var webView: WKWebView! @IBOutlet var containerView: UIView? = nil @IBOutlet weak var

How can I scrape text and images from a random web page?

北城以北 提交于 2021-02-07 12:39:22
问题 I need a way to visually represent a random web page on the internet. Let's say for example this web page. Currently, these are the standard assets I can use: Favicon : Too small, too abstract. Title : Very specific but poor visual aesthetics. URL : Nobody cares to read. Icon : Too abstract. Thumbnail : Hard to get, too ugly (many elements crammed in a small space). I need to visually represent a random website in a way that is very meaningful and inviting for others to click on it. I need

How can I scrape text and images from a random web page?

徘徊边缘 提交于 2021-02-07 12:38:13
问题 I need a way to visually represent a random web page on the internet. Let's say for example this web page. Currently, these are the standard assets I can use: Favicon : Too small, too abstract. Title : Very specific but poor visual aesthetics. URL : Nobody cares to read. Icon : Too abstract. Thumbnail : Hard to get, too ugly (many elements crammed in a small space). I need to visually represent a random website in a way that is very meaningful and inviting for others to click on it. I need

Load custom error htmlString when WKWebView loadRequest fails

二次信任 提交于 2021-02-07 12:31:32
问题 In my controller I have a call to WKWebViewInstance.loadRequest(url). If there is no internet available, I want to load an error message in the WKWebView. I have found that func webView(webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: NSError) gets called when a WKWEbView navigation fails with no internet connection. When I make the webView.loadHtmlString() call inside the above delegate method, nothing happens. How do I detect the absence of

WKWebView Cache manifest not working IOS8

走远了吗. 提交于 2021-02-06 12:29:01
问题 Cache manifest works fine and events fired in safari in IOS 8. Not working at all in WKWebView anyone else solve this issue? import UIKit import WebKit class ViewController: UIViewController { @IBOutlet var containterView : UIView! = nil var webView : WKWebView? override func loadView(){ super.loadView() self.webView = WKWebView() self.view = self.webView! } override func viewDidLoad() { super.viewDidLoad() var url = NSURL(string:"http://html5demos.com/offlineapp") var req = NSURLRequest(URL

Loading local css & js files into WKWebView

点点圈 提交于 2021-02-06 11:01:03
问题 in Swift 2.1.1 & Xcode 7.1 My code uses WKWebView and loads index.html form a local file but fails to load index.css and other javascript files as shown in the head tag. My best guess is that the baseURL is not correct, if so, How can I set the baseURL correctly? Thanks import UIKit import WebKit class ViewController: UIViewController { @IBOutlet var containerView: UIView! = nil //allows the class to refrence WKWebView var webView: WKWebView? override func loadView() { super.loadView() self

Loading local css & js files into WKWebView

笑着哭i 提交于 2021-02-06 10:57:18
问题 in Swift 2.1.1 & Xcode 7.1 My code uses WKWebView and loads index.html form a local file but fails to load index.css and other javascript files as shown in the head tag. My best guess is that the baseURL is not correct, if so, How can I set the baseURL correctly? Thanks import UIKit import WebKit class ViewController: UIViewController { @IBOutlet var containerView: UIView! = nil //allows the class to refrence WKWebView var webView: WKWebView? override func loadView() { super.loadView() self

Http and Https calls not working after Cordova upgrade

╄→尐↘猪︶ㄣ 提交于 2021-01-29 18:23:26
问题 I built an app by using Cordova and it's in production for more than years. Recently few days back I upgraded my Cordova version from 9.x to 10.x. After upgrade, Http and Https calls are not working. I am using Axios to make API calls. After I did research on this issue I found some solutions to add cordova-plugin-wkwebview-file-xhr. I did but no luck. I placed my config.xml file for the reference. Getting the following error while making API calls nativeXHR: Invalid url scheme null It would