简体   繁体   English

Safari执行时,IOS WKWebView和UIWebView未加载JavaScript Sign Up表单

[英]IOS WKWebView and UIWebView isn't loading JavaScript Sign Up form while Safari does

In Safari my Sign Up form JavaScript code works fine, but in UIWebView and in WKWebView that form isn't loading. 在Safari中,我的“注册”表单JavaScript代码可以正常工作,但是在UIWebView和WKWebView中,该表单无法加载。

Here is my Code to review. 这是我要检查的代码。

import UIKit
import WebKit


class ViewController: UIViewController, WKNavigationDelegate {

@IBOutlet weak var Webview: UIWebView!

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

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. Safari和WKWebView。

在此处输入图片说明 在此处输入图片说明

Any help regarding this that my WKWebView start behaving like Safari and open each and everything correctly as Safari browser does. 我的WKWebView会像Safari一样表现出任何与此有关的帮助,并像Safari浏览器一样正确打开所有内容。

When I put my website link here in this WKWebView browser then its working. 当我将我的网站链接放在此WKWebView浏览器中时,它将正常工作。 https://github.com/mbarnig/WKWebView https://github.com/mbarnig/WKWebView

so why not in my code. 所以为什么不在我的代码中。 I used the same code in my app but in vein. 我在我的应用程序中使用了相同的代码,但这样做是正确的。

Thank you in Advance! 先感谢您!

Your web page Signup form ( iframe ) has SSL issue. 您的网页注册表单( iframe )出现SSL问题。

In iOS, If you are loading an http url, then you have to add App Transport Security Settings in your info.plist file. 在iOS中,如果要加载http URL,则必须在info.plist文件中添加“ App Transport Security Settings

    <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. 在菜单上启用Safari开发人员模式Safari->首选项->高级->显示开发人员选项。
  2. Run your app on simulator and Open Safari browser on your Mac. 在模拟器上运行您的应用程序,并在Mac上打开Safari浏览器。
  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.com/LampeOptin/LampeOptinReferralForm.html 错误:无法加载资源:发生SSL错误,并且已安全连接到 https://www.lampeplacementservices.com/LampeOptin/LampeOptinReferralForm.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM