简体   繁体   中英

Why is Chrome submitting extra form fields? Is it a bug with Chrome?

I have a form being inserted into a page with jQuery. In all other browsers, it submits correctly... but in Chrome, some extra form fields from other forms on the page are being added to the POST. I'm not using javascript to submit the form, the form is just added with javascript and then submitted with a standard submit input.

Has anyone else had similar experience? Or any ideas on how to deal with this?

Thanks

如果该表单嵌套在另一个表单中,则可能会触发浏览器,无法确定您要发送的表单及其值,并且会尽力发送自己认为属于该表单的任何值。

If this works in other browsers and not in chrome, then you might want to submit a bug. You can do that here . You might also drop by the chromium irc channel on freenode. The people there are usually pretty helpful and might be able to tell you if this is a known bug.

The issue is with the insertion of a noscript tag into the DOM via javascript. I was receiving some HTML from the server with a noscript tag that had a select tag in that. Apparently WebKit-based browsers submit that input with the form.

The simple fix was to parse the HTML with jQuery and remove the noscript tags like so:

$response.find('noscript').remove();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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