Join 3,554 readers in helping fund MetaFilter (Hide)


Blogger Tracker
June 23, 2004 9:37 AM   Subscribe

HTML Help:
I want to post a link - then after the link has been visited by the reader and the reader returns back to my site - a message appears in the post. Is this possible? Using Blogger.
posted by thomcatspike to Computers & Internet (10 answers total)
 
I think it's possible using CSS, though you get into browser issues. You'd use something like

a:visited:after {
content: "(you've already seen this)";
color: #999;
}

(you could add other styling rules to this as well)

Here are the problems:

1. I've never tried putting a pseudo-selector on top of a pseudo-selector, so I don't know if this would work.
2. Internet explorer doesn't deal with CSS generated content. Not that anyone uses it.

There's probably a way to handle this with javascript, but I couldn't say how.
posted by adamrice at 9:51 AM on June 23, 2004


You could define a large area for the link, and use the a:link and a:visited CSS selectors to insert different background images for each state, the a:visited one containing the message.

A better hack would be to try to use a CSS2 sibling selector:

a#mySpecialLink:link + p { display: none; }
a#mySpecialLink:visited + p { display: block; }

This rule applies to a paragraph immediately following the anchor with id mySpecialLink. I have no idea if any browsers support CSS2 sibling selectors in combination with the link and visited pseudo classes.

Good luck.
posted by bradhill at 9:59 AM on June 23, 2004


This is a perfect use for generated content. The browser support just sucks.

I don't know if that would validate, bradhill, since technically an anchor has to be contained within a paragraph (or other block-level container). Now, if you had

<a href="http://mylink.com">My Link</a> <span id="#displayAfterVisit">Display this text after the visit</span>

and

a#mySpecialLink:link + span#displayAftervisit { display: none; }
a#mySpecialLink:visited + span#displayAfterVisit { display: block; }


then you'd probably be good.

What kind of "message" do you want to appear?
posted by DrJohnEvans at 10:15 AM on June 23, 2004


What kind of "message" do you want to appear?
My "message" for the post's existence.
Basically once a reader has viewed the link - the "message" appears which would then complete the full post for the reader.
posted by thomcatspike at 10:43 AM on June 23, 2004


Also, how can I have the link when finished, return the reader back to my blog? The link links you through a series of links by clicking the next button at the bottom of the links page.
posted by thomcatspike at 10:57 AM on June 23, 2004


This could certainly be done with Javascript. You could link to a Javascript function that could set a visited flag based on the visitied link in a cookie. Then when the user returns to your site, the flag in the cookie could be tested to determine if the rest of the post should be displayed.

If the link is to an external site, the only way to refresh your site after they are done may be to open it in a pop-up window. That way when the window is closed, the code on your site can be poked to either refresh the page or just dynamically finish displaying the post.
posted by rglasmann at 11:19 AM on June 23, 2004


If you do get this working (from either the help here or otherwise), could you post a link to your example so we HTML/CSS neophytes can see how it works?
posted by grum@work at 1:31 PM on June 23, 2004


Thank for the help so far. At this time it not working and trying to my homework with the help given.

grum@work sure no problem if it's successful.
One reason I quit posting on my blog was of timeline - by the time I could find time posting it - could be found everywhere. Have to be the first, not really, just don't want the posts to be a "copycat" thought.
posted by thomcatspike at 3:19 PM on June 23, 2004


Set some flag in a cookie using the javascript onclick event of the relevent link. In the onload event of the page where all this happens, subsequently sniff for the cookie on later visits. Adjust content dynamically according to the cookie's existance, or otherwise. The whole business could be even easier done server-side, but I doubt Blogger allow you access to that.
posted by normy at 7:42 PM on June 23, 2004


Oh, and don't expect it to be 100% reliable. Visitors with javascript disabled, folks who block cookies or regularly erase them, cross-browser conundrums, plenty of reasons for it to fail.
posted by normy at 7:47 PM on June 23, 2004


« Older Can anyone recommend a free ma...   |  A friend is looking for prints... Newer »
This thread is closed to new comments.