首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Html Amp Post是否显示当前页面的url?

Html Amp Post是否显示当前页面的url?
EN

Stack Overflow用户
提问于 2016-12-16 22:05:39
回答 1查看 432关注 0票数 0

Html Amp Post转到当前url?

代码语言:javascript
复制
<!doctype html>
<html ⚡>
<head>
  <meta charset="utf-8">
  <script async src="https://cdn.ampproject.org/v0.js"></script>
  <script async custom-element="amp-form" rc="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
</head>
<body>
    <form class="-amp-form" method="post" target="_top" novalidate="" action-xhr="/Home/About">
        <input name="name" class="data-input" required="" type="text" placeholder="Name...">
        <input name="email" class="data-input" required="" type="email" placeholder="Email...">
        <input class="button button-primary" type="submit" value="Subscribe">
    </form>
</body>
</html>

将鼠标悬停在浏览器中的提交输入按钮上会显示当前的url,而单击该按钮似乎什么也不做(使用httpFiddler时,不会发生post或get请求)。解决方案是一个标准的MVC5应用程序,将布局更改为在⚡声明和脚本中包含amp Html符号。你知道为什么当鼠标悬停在按钮上时会显示当前的url吗,比如https://localhost:44331/Home/Index,而当表单按钮被点击时却不会用上面的代码发布任何帖子?

这是我一直关注的资源之一:https://ampbyexample.com/components/amp-form/

EN

回答 1

Stack Overflow用户

发布于 2016-12-17 04:18:12

帖子正在工作,只是在帖子之后没有重定向到视图。浏览器使用表单上的'action‘属性来显示用户将被发送到的url,由于在amp action-xhr post中省略了此值,因此它只显示当前的url;然而,当单击它时,它仍然发送到正确的url。我想做的是一个帖子和重定向,目前似乎只有Get amp请求支持页面重定向。这在将来可能会改变,但目前它需要使用Get请求进行页面重定向。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41186140

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档