开发者

How to make child-navigation not affect parent browser history?

I have a main page which contains a simple iframe. Iframe source = a php file. The PHP have a link the user can click, but whenever clicked, the browser hi开发者_运维技巧story increases.

I want the iframe to be independent, without affecting history. Possible? I am not familiar with ajax btw.

PS: Its only 1 link in the iframe which can be clicked.

Thanks


The only thing that comes to my mind is to use location.replace to change the URL in the iframe , when the link is clicked.

That method doesn't store the current page in the browser's session history, for example:

<a href="http://google.com"
   onclick="location.replace(this.href);return false;"/>Google</a>

Or connecting the event programmatically:

<a href="http://google.com" id="linkId">Google</a>

...

document.getElementById('linkId').onclick = function () {
  location.replace(this.href);
  return false;
};

Check an example here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜