gpt4 book ai didi

ios - 检测 POST 方法/按钮单击 UIWebView

转载 作者:行者123 更新时间:2023-11-30 12:30:29 25 4
gpt4 key购买 nike

我正在尝试处理此处的单击按钮:Link button这是代码:

<form action="/contest-voting/" method="post" id="pimp-entities-contest-voting-form" accept-charset="UTF-8"><div><input type="hidden" name="nid" value="1200">

<input type="hidden" name="fb_id" value="">

<input type="hidden" name="form_build_id" value="form-iZa3h_R56jG3BZpQCaktyWo8exlP8PnURETJEm0omUk">

<input type="hidden" name="form_id" value="pimp_entities_contest_voting_form">
Nutze deinen <input type="image" id="edit-facebook" name="facebook" value="Per Facebook abstimmen" src="http://www.pimp-your-school.de/sites/all/themes/pimp_foundation/images/icon-voting-fb.png" class="form-submit">-Account oder deine <div class="form-item form-type-textfield form-item-email">

<input placeholder="E-Mail-Adresse" type="text" id="edit-email" name="email" value="" size="60" maxlength="128" class="form-text">

<input type="image" id="edit-submit" name="submit" value="Per E-Mail-Adresse abstimmen" src="http://www.pimp-your-school.de/sites/all/themes/pimp_foundation/images/icon-voting-3.png" class="form-submit"></div></form>

我已经尝试了所有这些 StackOverflow 链接,但都不起作用:

Identify submit button click of UIWebview ,

Grabbing POST data from UIWebView ,

UIWebView capture post ,

Swift UIWebView shouldStartLoadWithRequest doesn't fire in iOS8 ,

Call swift function with javascript using UIWebview

还有其他方法吗?

最佳答案

我无法通过您的问题判断您是否正在尝试提交表单或观察表单何时提交。但如果您尝试提交表单,则可以执行此操作。

func webViewDidFinishLoad(_ webView: UIWebView) {

// This adds an email to the email text field. This takes the id of the email text field.
webView.stringByEvaluatingJavaScript(from: "document.getElementById('edit-email').value = \"example@example.com\"")

// This submits the field. This takes the id of the form.
webView.stringByEvaluatingJavaScript(from: "document.getElementById('pimp-entities-contest-voting-form').submit()")

}

我不确定如何观察正在提交的表单,因为

func webViewDidStartLoad(_ webView: UIWebView)

在表单提交时似乎不会被调用,因为通常情况下,当url改变时你会使用这个函数。它应该更改为 http://www.pimp-your-school.de/contest-voting/但事实似乎并非如此。

关于ios - 检测 POST 方法/按钮单击 UIWebView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43620220/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com