Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Controlling when cookie is set #4

Open
brandondurham opened this issue Feb 3, 2013 · 1 comment
Open

Controlling when cookie is set #4

brandondurham opened this issue Feb 3, 2013 · 1 comment

Comments

@brandondurham
Copy link

I've create a site that's essentially like a book. The home page is the "cover" and each post is a new "chapter". On the home page I have a link that takes the visitor to either the first chapter or the latest chapter, depending on whether or not they're a new visitor. Currently I'm deciding which link to show by using your .repeat-visitor and .first-visit classes, but they're not working quite like I need them to.

For instance, if a visitor comes to the home page for the first time they'll see the link to the first chapter. Then if they hit refresh they'll see a link to the latest chapter, even though they haven't yet actually gone to the first chapter/post.

I'd love a more granular level of control. I'd like to be able to say:

  • If they're read the first post then show a link to the latest post.
  • If they haven't, then show a link to the first post.

Is it possible to control when the user is flagged as having read a particular page?

@benbrown
Copy link
Member

You can use the :visited pseudo-class to do this, or you can track the specific page visits with a cookie or a flag in local storage. Unfortunately, you cannot access the :visited state via Javascript.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants