Manchestor Laljii
Manchestor Laljii

Reputation: 73

Get browser to remember a:visited link until browser is closed

I have used a:visited CSS for my web application, but the browser remember its history for unlimited time.

How can I set this time till the browser is closed?

Upvotes: 0

Views: 327

Answers (2)

C3roe
C3roe

Reputation: 96325

That is a browser setting, nothing you can influence with CSS.

Alternatives:

  • Make the links “different” for each browsing session, f.e. by appending a random GET parameter/query string value, or

  • do not use :visited in the first place, but keep track of clicked links via JavaScript and sessionStorage or a cookie, and then set a class on those elements every time a page is loaded, to achieve the formatting you want for that state.

Upvotes: 2

Quentin
Quentin

Reputation: 943615

You can't. How long a browser keeps a URL in its history is entirely up to the browser and there are no APIs that allow a website to influence it.

Upvotes: 0

Related Questions