开发者社区> 问答> 正文

Form表单的action跳转URL问题

如题,在form表单中的action属性的值可以写成目标相对路径或URL绝对路径。在W3School中是这样描述的:

Where to send the form-data when the form is submitted.
Possible values:

•An absolute URL - points to another web site (like action="http://www.example.com/example.htm")
•A relative URL - points to a file within a web site (like action="example.htm")

现在我有下面的代码:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
  </head>
  <body>
    <form method="post" id="aspnetForm" name="loginform" action="https://securecn.englishtown.com/login/handler.ashx">
      <input name="username" type="hidden" value="xxxxxxxx"/>
      <input name="password" type="hidden" id="et-password" value="123456">
      <input name="p" type="hidden" id="txtPartner" value="Elef">
    </form>
    <script language="javascript">
      document.loginform.submit();
    </script>
  </body>
</html>

为了保密我把username给替换了。
把这些保存成html文件,在本地直接双击打开,是可以跳转到https://securecn.englishtown.com/login/handler.ashx并登陆成功的。
但,我把这个文件部署在服务器上,服务器会自动在文件所在的目录寻找login/handler.ashx,显然我服务器上没有这个东西,于是报出404。

为什么部署在服务器上就不能跳转了呢?

展开
收起
杨冬芳 2016-06-15 15:47:55 3056 0
1 条回答
写回答
取消 提交回答
  • IT从业

    这么简单的问题自己http抓一下包不就知道了

    https://securecn.englishtown.com/login/handler.ashx 对网站来源进行了检测,你form跳转过去,对端网站拒绝访问又给你跳转回来了。

    解决方案:通过ajax提交 这样他们就检测不到来源了~~

    2019-07-17 19:39:30
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载