【问题标题】:IE8 does not submit hidden input in formIE8 不提交表单中的隐藏输入
【发布时间】:2014-05-22 15:29:47
【问题描述】:

我在一个项目中发现了这个表单,它在 Chrome 中运行良好,但在 Internet Explorer 中却不行。 IE8 确实将表单作为 POST 提交,但不发送隐藏输入:

    <form name="logout_frm" id="logout" action="index.php" method="post">
        <label>Logout</label>
        <input type="hidden" name="logout" value="1" />
        <input type="submit" name="logoutBtn" value="logout" />
    </form>

这是我从fiddle2 获得的原始数据,WebForms Tab 也是空的:

POST https://example.com/index.php HTTP/1.1
Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, */*
Referer: https://hostname.net/index.php
Accept-Language: de-DE
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: hostname.net
Content-Length: 0
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: GUEST_LANGUAGE_ID=en_US; COOKIE_SUPPORT=true; ntlm=1; PHPSESSID=28b0fbgol5bnq56qqst423p80ota470sqclbnpc4p5egqqdbt4tw
Authorization: NTLM TlRMTVNTUAABAAAAB4IIogAAAAAAAAAAAAAAAAAAAAAAAbEdAAAAAA==

更新

如果我清除缓存并重新加载页面,它会运行一次,但只能运行一次。也许这与 NTLM 登录 Authorization: NTLM 有关。

【问题讨论】:

  • 无论如何,依赖隐藏字段通常不是一个好主意,因为它们的值可以通过 js 或 devtools 轻松更改。
  • @Mooseman 你在说什么?
  • 一般@Mooseman 是对的,但在这种情况下,隐藏字段的内容无关紧要,通过操作不会造成任何伤害。

标签: html forms post internet-explorer-8


【解决方案1】:

在我注意到它是关于 caching 的一些东西之后,它只是禁用了它,现在它可以工作了:

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

这不是一个真正的答案,因为它没有解释这里正在做什么,但它是一种解决方法。

【讨论】:

    【解决方案2】:

    您复制了 logout 名称。重命名隐藏字段或表单。

    【讨论】:

    • 我重命名了表单,但没有任何区别。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-29
    • 1970-01-01
    • 2017-08-08
    • 2018-03-13
    • 2012-09-18
    相关资源
    最近更新 更多