开发者

Make link for last page visited in current website?

How can I make a link which goes to the last page visited which was part of the current site?

Another way of saying this is, I need a link which is like the browser back button, un开发者_运维问答less the last page visited was a different website. If this is the case the link could either go to the last page on the current site that was visited, or an arbitrary back up could be used.

UPDATE. Would javascript be the easiest solution? The code below works as a back button: [Go Back]

So, could I add some logic that made it work as normal if the last page was part of the current site, and provided a back up if the last page visited wasn't from my site? Thanks


Something like this should work, but you'll need more logic to handle the first visit, and I'm not sure if request_uri returns the exact format you need for the link:

<a href="<?php print $_SESSION('last_page'); ?>">Back</a>
<?php $_SESSION('last_page') = request_uri(); ?>


NeXXeuS came up with a jQuery solution here:

Javascript / jQuery back button - so long as last page was part of current site? Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜