Form submission canceled because the form is not connected 异常
2017-04-07 10:09
549 查看
转自 http://majing.io/questions/821
在项目中 用 jquery 创建了 form对象,并提交 ,在 chrom 下 控制台 里输出了 Form submission canceled because the form is not connected 异常,
搜索后 得知是 chrome修复的一个bug ,记录下来。
之前在Chrome里运行正常的代码,Chrome升级到56后报表单提交错误:
Form submission canceled because the form is not connected
代码如下:
问题解决
原因
HTML标准规定如果form表单没有被添加到document里,那么form表单提交将会被终止。
参考:Form submission algorithm
在Chrome56之前的版本是不符合标准的,Chrome56修复了这个问题,让form表单提交符合标准要求:
参考:Chrome issue 2416033002
解决方法
解决方法就是把form表单添加到document后再提交:
jQuery
或
在项目中 用 jquery 创建了 form对象,并提交 ,在 chrom 下 控制台 里输出了 Form submission canceled because the form is not connected 异常,
搜索后 得知是 chrome修复的一个bug ,记录下来。
之前在Chrome里运行正常的代码,Chrome升级到56后报表单提交错误:
Form submission canceled because the form is not connected
代码如下:
function submitData(name) { var form = $('<form method="post" action="updateName">' +'<input type="submit"/>' +'<input type="hidden" name="name" value="'+ name +'" /></form>'); $('input[type="submit"]', form).click(); }
问题解决
原因
HTML标准规定如果form表单没有被添加到document里,那么form表单提交将会被终止。
参考:Form submission algorithm
在Chrome56之前的版本是不符合标准的,Chrome56修复了这个问题,让form表单提交符合标准要求:
参考:Chrome issue 2416033002
解决方法
解决方法就是把form表单添加到document后再提交:
jQuery
$(document).append(form);
或
document.body.appendChild(form);
相关文章推荐
- Jquery组织Form表单提交之Form submission canceled because the form is not connected
- Chrome浏览器下报Form submission canceled because the form is not connected
- jquery使用 Form submission canceled because the form is not connected
- jquery使用 Form submission canceled because the form is not connected
- js代码提交表单出现:form submission canceled because the form is not connected
- AJAX POST 后跳转页面Form submission canceled because the form is not connected的问题解决
- Form submission canceled because the form is not connected
- Form submission canceled because the form is not connected 解决办法
- Chrome报表单提交错误,Form submission canceled because the form is not connected
- 异常-----Can't convert the date to string, because it is not known which parts of the date variable are in use. Use ?date, ?time or ?datetime built-in, or ?string.\u003Cformat> or ?string(format) built-
- 在MOSS2007上加载工作流出现以下错误:“The form cannot be displayed because session state is not available”
- SmtpClient发送邮件遭遇The specified string is not in the form required for a subject.
- fix errors 1088: “Failed to execute request because the App-Domain could not be created. Error: 0x80070005 Access is denied” and 1334: “Exception: System.IO.FileLoadException”
- [Solved]: System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use.
- [转]BIZTALK: Cannot perform encryption or decryption because the secret is not available from the master secret server
- 子窗体 The path is not of a legal form
- BIZTALK: Cannot perform encryption or decryption because the secret is not available from the master secret server
- C#使用Create创建文件后,报The Process cannot access the file because it is being used by another process的异常
- Error: theForm.submit is not a function !!
- Unable to start debugging on the web server. Debugging failed because integrated windows authentication is not enabled.