[英]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.referrer
或window.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.