简体   繁体   English

如何使锚标签链接删除过去访问过的页面?

[英]How to make an Anchor Tag link erase past visited page?

I have a anchor tag.我有一个锚标签。 For the first time(color deep blue link) when I click it, it redirects me to my dynamic graph which forms a curve, you can see the curve being rendered.第一次(颜色深蓝色链接)当我单击它时,它会将我重定向到我的动态图,其中 forms 一条曲线,您可以看到正在渲染的曲线。

But when for the second time when I click the anchor tag(pale pink color), it redirects me to the same dynamic graph but the graph is already loaded/rendered, you don't see the curve being rendered.但是,当我第二次单击锚标记(淡粉色)时,它会将我重定向到同一个动态图,但该图已经加载/呈现,您看不到正在呈现的曲线。

Can I solve this problem, as I always want the link and graph react as if its always rendered for the first time我可以解决这个问题吗,因为我总是希望链接和图形的反应就像它总是第一次呈现一样

How to solve this by either using JavaScript or PHP. Thanks in advance.如何使用 JavaScript 或 PHP 解决此问题。提前致谢。

Image showing link has already been visited图片显示链接已被访问

  1. If you have issue with just colour of the link then you can change the colour in css如果您对链接的颜色有疑问,那么您可以在 css 中更改颜色

 a:visited{ color: ' #00008B' }

  1. For re-rendering the links on map. Try clearing cache because browsers stores cache of the all websites that you have visited.重新呈现 map 上的链接。尝试清除缓存,因为浏览器会存储您访问过的所有网站的缓存。 This answer talks about how programmatically empty browser cache.这个答案讨论了如何以编程方式清空浏览器缓存。

You could trick the browser by changing the URL everytime by adding a random parameter.您可以通过添加随机参数每次更改 URL 来欺骗浏览器。 You may name it totally different if you like.如果你愿意,你可以给它起完全不同的名字。

printf('<a href="graph.php?rand=%s">Visit my graph</a>', microtime(true));

So the URL looks like different on every call and won't get the cache hit, because it is not the same.所以 URL 在每次调用时看起来都不一样,不会命中缓存,因为它不一样。

<a href="graph.php?rand=1670596569.4425">Visit my graph</a>
<a href="graph.php?rand=1670596599.099">Visit my graph</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM