将用户的历史记录保存在一个网站上
Keep the history of the user on one web-site
我知道关于这个话题的帖子很少
但是,我想以略有不同的方式提出这个话题:
我怎么知道用户是从特定页面回来的,比如/product_pages/3
我使用骨干作为我想跟踪用户历史记录的部分,该部分建立在 RoR 应用程序之上。我想知道用户是否从特定页面返回的原因是保持主干表单填充用户最初输入的值,但是如果用户来自其他页面,例如/provider_pages/14
,那么我想清除表单值。
尝试过的解决方案:
HTML5历史记录在浏览器中(即使在FF和Chrome之间)也不会持久存在,并且尝试过它不是解决此问题的最佳解决方案;骨干历史不能解决问题,因为它只跟踪骨干应用程序,每当用户走出骨干应用程序时,骨干历史就会失去状态;RoR 请求也不是解决方案,假设大多数用户会单击后退按钮返回表单/搜索结果,并且"后退"按钮不会触发新的请求:)
所以我对这个问题的解决方案有点困惑。
以下是代码片段:
形式:
<ul id="formfields">
<li>
<label>Driver type
<select id="driver-type" name="driver-type" class="ddl jqrequired">
options...
</select></label>
</li>
<li>
<label>Postcode
<input type="text" name="postcode" id="postcode_with_suburbs" style="width:207px" class="jqrequired postcode-with-suburb"></label>
</li>
<li id="date_insurance_required_section">
<label>Date insurance required
<input type="text" name="date_insurence_required" id="date_insurance_required" style="width:207px" class="jqrequired"></label>
<span style="display:none;" id="renewalDate"></span>
</li>
<li id="car-insurers-section">
<label>Your current car insurer (if applicable)
<input type="text" id="car-insurers" style="width:220px" class="ddl clearfix" class="jqrequired" placeholder="Please enter current insurer">
</label>
</li>
etc etc etc.....
通过获取请求在主干端设置值:and I assume here is the place where I need to keep track of users that are coming back
$("#car-insurers").val(results.Insurer);
$("#renewal_date").val(results.RenewalDate);
$("#date_insurence_required").val(results.InsuranceRequired);
$("#renewal-type").val(results.RenewalType);
$("#renewal-amount").val(results.RenewalAmount);
$("#driver-type").select2("val", results.DriverType);
$("#postcode_with_suburbs").val(results.Postcode);
$("#email").val(results.EmailAddress);
if (results.EmailSend == "on") {
$('#email-consent').prop('checked', true);
}
一些提示,
-
为来自服务器的每次访问将最后一个路径>时间戳写入 Cookie。
-
将访问历史记录写入本地存储(大多数现代浏览器都支持此功能)
相关文章:
- 有任何可能将facebook实时信使整合到一个网站中
- 如何使用JS/jQuery在另一个网站上显示iframe中的特定内容
- Javascript.如何用javascript将信息发送到另一个网站
- 如何从特定类别重定向到另一个网站
- jquery点击另一个网站上的按钮
- Firefox将我转发到另一个网站,而不是在Drag&滴
- 代理一个网站能够在iframe中进行所见即所得编辑-它是如何工作的
- window.onclick在一个网站中使用两次
- 用PHP读取另一个网站的源代码,并将其作为字符串提供给JavaScript
- 在我的浏览器中用类似ctrl+s的PhantomJS保存一个网站
- 下载网站'的内容并在另一个网站中显示(部分)
- 有没有一个网站可以生成所有可能的显示单词的方式
- 将登录链接到另一个网站而不提供密码
- 在一个网站上包含多个声音文件
- Javascript对一个网站起到了反作用
- 如何在我的服务器上创建javascript,该服务器使用该服务器上的后端,并将在另一个网站上使用
- 通过javascript将RSS提要广播到另一个网站
- 我正在尝试为一个网站创建一个文本框,可以将文本更改为用户希望的任何格式
- 使用表单值在另一个网站上创建帐户
- 一个网站有什么方法可以区分微软边缘和谷歌Chrome吗;的渲染引擎