Mat*_*t B 13 javascript parameters url redirect
单击电子邮件中的动态链接后,我的用户将登陆到一个页面,其中包含预先填充的表单,如下所示:
http://www.test.com/november_promo/default.html?Name=Test&Email=Test.com
脚本一开始就运行,将它们重定向到页面的移动版本:
<script type="text/javascript" src="redirection_mobile.min.js"></script>
<script type="text/javascript">
SA.redirection_mobile ({param:"isDefault", mobile_url: "www.test.com/november_promo/default_mobile.html", mobile_prefix : "http://", cookie_hours : "1" });
</script>
Run Code Online (Sandbox Code Playgroud)
有没有办法在重定向这些参数时保留这些参数?
我知道有更好的方法可以使用PHP进行移动重定向,但我公司的服务器对于让我的部门目录提供PHP文件非常粗略,因此我们尝试使用Javascript完成所有操作.
小智 22
document.location.search
Run Code Online (Sandbox Code Playgroud)
可用于将当前位置查询字符串附加到javascript中的字符串
例如
<script>
var uri = 'foobar.html';
// while current location is 'baz.html?foo=1&a=b' for example
uri = uri + document.location.search;
// this will output 'foobar.html?foo=1&a=b'
alert(uri);
</script>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18119 次 |
| 最近记录: |