自动添加到URL的末尾

时间:2015-09-06 10:26:26

标签: php html html5

我正在创建一个供人们下载和自行安装的工具。我们可以轻松安装,我们需要这样的字符串:?example=%s&example2=%m;自动添加到URL的末尾,如下所示:http://example.com;访问页面时自动,没有页面重定向或任何内容。

因此,如果用户下载并安装它,您就不必自己制作网址:http://example.com?example=%s&example2=%m

1 个答案:

答案 0 :(得分:2)

我希望这就是你所要求的pushState

<script type="text/javascript">
var ex1='feroz';
var ex2='akbar';
if (history.pushState) {
    var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?example='+ex1+'&example2='+ex2;
    window.history.pushState({path:newurl},'',newurl);
}
</script>
相关问题