[英]Javascript : go back with new parameters
I have a problem with the history.back()
function. 我有
history.back()
函数的问题。
I have three page A,B,C: 我有三页A,B,C:
history.back()
. history.back()
从C回到B. The problem is that back()
function use in fact the A to B link (from the history) that contains the parameters but I need to change these. 问题是
back()
函数实际上使用包含参数的A到B链接(来自历史),但我需要更改这些。
So I changed history.back()
to a simple href but of course, now if I click on back, I go back to C page (what I don't want). 所以我将
history.back()
更改为一个简单的href但当然,如果我点击后面,我会回到C页面(我不想要的)。
So is there a solution to use back()
with different parameters? 那么有一个使用
back()
和不同参数的解决方案吗? (I use Angular, may be something can help). (我使用Angular,可能会有所帮助)。
A.html : A.html:
<body ng-controller="AuthentCtrl">
<div align="center">
<button ng-click="location.href = 'view/listing.html?id=' + id + '&first=' + newAuthent;">Go!</button>
<br/>
</div>
</body>
B.html B.html
<body onload="init()">
<script>
function init(){
var params = location.search.substring(1).split('&');
id = params[0].split('=')[1];
var firstCo = params[1].split('=')[1];
// execute some code, function of parameters
}
</script>
</body>
C.html C.html
<body>
<div align="center">
<button ng-click="history.back()">Go!</button>
<br/>
</div>
</body>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.