admin管理员组文章数量:1332339
I built a facebook tab which has a form to fill out. However below the form there is a link to a terms and conditions page which sits on a different URL from the form.
The form is on: page/like and the T&C page is on page/terms
In the T7C page there is a back button which inside the href has the following:
href="javascript:window.history.back()"
and this button suppose to bring you back to the form after you have red the T&C.
This works fine on a testing server, however as soon as it's embedded in facebook the back button stops working and it doesn't go back to the form but to the home page of the brand.
The other issue that I have just came across is the if I fill out some of the fields and then I click on the T&C page and go back to the form using the back button the input fields are all empty.
Is there a way front-end side that this can be fixed too?
I built a facebook tab which has a form to fill out. However below the form there is a link to a terms and conditions page which sits on a different URL from the form.
The form is on: page/like and the T&C page is on page/terms
In the T7C page there is a back button which inside the href has the following:
href="javascript:window.history.back()"
and this button suppose to bring you back to the form after you have red the T&C.
This works fine on a testing server, however as soon as it's embedded in facebook the back button stops working and it doesn't go back to the form but to the home page of the brand.
The other issue that I have just came across is the if I fill out some of the fields and then I click on the T&C page and go back to the form using the back button the input fields are all empty.
Is there a way front-end side that this can be fixed too?
Share Improve this question edited Jun 7, 2013 at 14:58 Aessandro asked Jun 7, 2013 at 14:17 AessandroAessandro 5,77121 gold badges72 silver badges146 bronze badges 1- its possible that the anchor click is causing the history to increment by one. (just a hunch) – DevZer0 Commented Jun 7, 2013 at 14:20
3 Answers
Reset to default 3Does the console tell you anything?
Try window.history.go(-1);
.
Alternatively, have you tried opening the T&C in a separate window using target="_blank"
? If you are worried about making sure the terms are read, inside the opened window, you may be able to run a function in the parent window using window.opener.readTC()
, where .readTC
is your function.
You can wrap this in a button:
<button type="button" onclick="window.history.go(-1)">Go back</button>
Try this example...
<html>
<head>
<script>
function goBack()
{
window.history.back()
}
</script>
</head>
<body>
<input type="button" value="Back" onclick="goBack()">
</body>
</html>
本文标签: Javascript historyback not workingStack Overflow
版权声明:本文标题:Javascript history.back not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742332903a2455050.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论