IE11-Only Submit Bug

2019-03-09 23:06发布

I have a form on a page, something simple like:

<form action="form/submit" method="post">
    <button type="submit">Submit</button>
</form>

It works in every single browser, including older versions of IE, BUT in IE11 it fails, with the tab stuck in a continuous loading loop, never changing to the "thank you" page after submission. HOWEVER, if I open the console, it DOES work.

I'm aware of the console.log issues IE has, and already am using:

if (!window.console) {
    console = {
        log: function() {}
    };
}

to avoid it, which seems to be doing fine (as mentioned, every other IE works). Any insight as to where the issue might lie?

8条回答
Ridiculous、
2楼-- · 2019-03-09 23:42

It's a bug in IE11. You can fix it if you add a name attribute to the button, like:

<button type="submit" name="foo" ...
查看更多
Animai°情兽
3楼-- · 2019-03-09 23:47

This doesn't directly relate to OP's question, but is an IE-only form submission issue:

If you happen to set form.prop('disabled', true) during the submit event, other browsers will still send the form data, but IE will not - it'll send an empty request body.

查看更多
beautiful°
4楼-- · 2019-03-09 23:48

A form without named element will result in an infinite loop on submit on IE11 + W8.1. To fix that, simply add an attribute name to the button:

<form action="form/submit" method="post">
  <input type="submit" name="cm" value="Submit">
</form>
查看更多
叼着烟拽天下
5楼-- · 2019-03-09 23:52

For me, I had empty hidden fields that were marked required. Pretty stupid but it was the solution that worked for me.

查看更多
地球回转人心会变
6楼-- · 2019-03-09 23:53

For IE11, there is :

event.returnValue = false;

Checking if event.preventDefault exists prevent an eventual error :

event.preventDefault ? event.preventDefault() : (event.returnValue = false);
查看更多
Juvenile、少年°
7楼-- · 2019-03-09 23:55

Your problem is caused by a issue with .net 4 on server side. Please read this: 'WebForm_DoPostBackWithOptions' is undefined in IE11 Preview

You can enable your IE debug function and try submit, you may see the error: WebForm_DoPostBackWithOptions

I fixed a similar submit problem for IE11 by patch this: http://support.microsoft.com/kb/2836939

查看更多
登录 后发表回答