最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

IOS WKWebView and UIWebView isn't loading JavaScript Sign Up form while Safari does - Stack Overflow

programmeradmin1浏览0评论

In Safari my Sign Up form JavaScript code works fine, but in UIWebView and in WKWebView that form isn't loading.

Here is my Code to review.

import UIKit
import WebKit


class ViewController: UIViewController, WKNavigationDelegate {

@IBOutlet weak var Webview: UIWebView!

var webView: WKWebView!
var websites = ["lampepany", "lampepany"]

override func loadView() {
    webView = WKWebView()
    webView.navigationDelegate = self
    view = webView
}
override func viewDidLoad() {
    super.viewDidLoad()

    let url = URL(string: "https://" + websites[0])!
    webView.load(URLRequest(url: url) as URLRequest)
    webView.allowsBackForwardNavigationGestures = true

}

Main page opens correctly and then Menu -> Apply, on this screen Apply here form doesn't display.

Here are both screenshots attached. Safari and WKWebView.

Any help regarding this that my WKWebView start behaving like Safari and open each and everything correctly as Safari browser does.

When I put my website link here in this WKWebView browser then its working.

so why not in my code. I used the same code in my app but in vein.

Thank you in Advance!

In Safari my Sign Up form JavaScript code works fine, but in UIWebView and in WKWebView that form isn't loading.

Here is my Code to review.

import UIKit
import WebKit


class ViewController: UIViewController, WKNavigationDelegate {

@IBOutlet weak var Webview: UIWebView!

var webView: WKWebView!
var websites = ["lampepany.", "lampepany."]

override func loadView() {
    webView = WKWebView()
    webView.navigationDelegate = self
    view = webView
}
override func viewDidLoad() {
    super.viewDidLoad()

    let url = URL(string: "https://" + websites[0])!
    webView.load(URLRequest(url: url) as URLRequest)
    webView.allowsBackForwardNavigationGestures = true

}

Main page opens correctly and then Menu -> Apply, on this screen Apply here form doesn't display.

Here are both screenshots attached. Safari and WKWebView.

Any help regarding this that my WKWebView start behaving like Safari and open each and everything correctly as Safari browser does.

When I put my website link here in this WKWebView browser then its working. https://github./mbarnig/WKWebView

so why not in my code. I used the same code in my app but in vein.

Thank you in Advance!

Share Improve this question edited Jun 8, 2017 at 20:43 Arsal asked Jun 8, 2017 at 20:31 ArsalArsal 3982 gold badges8 silver badges23 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6 +50

Your web page Signup form (iframe) has SSL issue.

In iOS, If you are loading an http url, then you have to add App Transport Security Settings in your info.plist file.

    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
        <true/>
    </dict>

I found the issue in the following way.

  1. Enable Safari Developer mode Safari-> Preference -> Advanced -> Show Developer option on Menu.
  2. Run your app on simulator and Open Safari browser on your Mac.
  3. Go to Developer menu -> Simulator -> Select your site url.
  4. You will get the console log of your web page.

Please see your web page console log below.

Error : Failed to load resource: An SSL error has occurred and a secure connection to https://www.lampeplacementservices./LampeOptin/LampeOptinReferralForm.html

发布评论

评论列表(0)

  1. 暂无评论