简体   繁体   English

填写联系表后,如何将用户返回到他们来自的页面?

[英]How do I return a user back to the page they came from after filling out a contact form?

I have a website in VB/asp.net 4 and a client may be on a page that says "contact an engineer" and it brings you to a contact form. 我有一个VB / asp.net 4的网站,客户可能在一个页面上写着“联系工程师”,它会带你到一个联系表格。 After filling out the form, it says: 填写表格后,它说:

Your message has been sent. 您的留言已发送。 Thank you for contacting USS Vision. 感谢您与USS Vision联系。 A member of the engineering team at USS Vision will respond to you at the earliest convenience. USS Vision工程团队的成员将尽快回复您。

I want to add a hyperlink saying "Return to the page you came from" and have them click it and go back to that page. 我想添加一个超链接,说“返回你来自的页面”并让他们点击它并返回到那个页面。 Is this possible, and if so, how would I go about doing it? 这是可能的,如果可以的话,我该怎么做呢? Thanks for any help anybody can offer! 感谢任何人提供的任何帮助!

Maybe document.referrer or window.history can help you. 也许document.referrerwindow.history可以帮助你。

UPDATE: 更新:

Based on comments to this answer I'm also suggesting to retrieve HttpRequest.UrlReferrer when user comes and save it in Session, then use it anywhere you need. 根据对此答案的评论,我还建议在用户到来时检索HttpRequest.UrlReferrer并将其保存在Session中,然后在任何需要的地方使用它。

Unless there's some compelling reason to have them leave the page they're on, it'd probably be easiest -- and a better user experience -- to handle that by opening the contact form in a modal window; 除非有一些令人信服的理由让他们离开他们所在的页面,否则通过在模态窗口中打开联系表单来处理它可能是最简单的 - 并且更好的用户体验; the user fills out the form, submits it, receives an acknowledgment, and closes the modal, no muss no fuss. 用户填写表单,提交表单,收到确认,并关闭模式,没有麻烦没有大惊小怪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从第三方网站填写表格后如何将用户重定向到 URL - How to redirect user to a URL after filling out a form from a third party site 用户登录后如何重定向回受保护的页面? - How do I redirect back to protected page after user logs in? 如何创建后退按钮,将您带回到您来自的页面? - How can I create a back button that takes you back to the page you came from? NextJS 将用户重定向回路由器来自身份验证后 - NextJS redirect user back to the router came from after authentication Bootstrap之旅 - 如何从目的地页面返回? - Bootstrap Tour - How do I return back from destination page? 提交联系表格后如何到达页面上的特定位置? - How do I get to a specific location on page after submitting contact form? 填写所有表单字段后如何从 javaScript 重定向到页面 - how to redirect to a page from javaScript after filling all the form fields 提交表单后如何将用户重定向到另一个页面? - How do I redirect user to another page after submit the form? 仅当用户来自该页面时,如何在提交表单后将 CodeIgniter 中的 URL 重定向回上一页? - How to redirect URL in CodeIgniter after form submission back to the previous page only when the user comes from that page? 如果用户来自网站上的上一页,那么这样做,否则就这样做 - If user came from previous page on site then this, else do this
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM