Commit 3b538104 authored by Lorenzo Pichilli's avatar Lorenzo Pichilli Committed by GitHub

Merge pull request #27 from igtm/encodeurl

[fix] encode resourceURL
parents a2b7e482 7dc29355
...@@ -746,7 +746,9 @@ class InAppBrowserWebViewController: UIViewController, UIScrollViewDelegate, WKU ...@@ -746,7 +746,9 @@ class InAppBrowserWebViewController: UIViewController, UIScrollViewDelegate, WKU
} }
else if message.name == "resourceLoaded" && (webViewOptions?.useOnLoadResource)! { else if message.name == "resourceLoaded" && (webViewOptions?.useOnLoadResource)! {
if let resource = convertToDictionary(text: message.body as! String) { if let resource = convertToDictionary(text: message.body as! String) {
let url = URL(string: resource["name"] as! String)! let rawUrl = resource["name"] as! String
let encodedUrl = rawUrl.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
let url = URL(string: encodedUrl)!
if !UIApplication.shared.canOpenURL(url) { if !UIApplication.shared.canOpenURL(url) {
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment