Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > making a site user aware

making a site user aware
Thread Tools
Dedicated MacNNer
Join Date: Jan 2002
Status: Offline
Reply With Quote
Aug 12, 2002, 11:37 AM
 
Hi

Does anyone know how to make a simple static HTML site user aware - what I want to do is have a online book, and when people have finished reading a chapter/page etc., they can click on a link that saves their location on a unique page.

Ideas/Comments/Suggestions?

Thanks
     
Mac Elite
Join Date: Mar 2001
Location: England
Status: Offline
Reply With Quote
Aug 14, 2002, 08:26 PM
 
The simplest way you could do that would be using Javascript and cookies. That means that nothing is stored on your servers (so you don't need any server software), but it's not a great method if you're wanting it to work perfectly in every case.

I found this function amongst a load of code scraps. It might be of help. Sorry I can't explain this technique very well, since it's ages since I've used Javascript for any more than a popup menu script.

Code:
<!--HIDE function storeIt() { var theDate=new Date() theDate.setMonth(theDate.getMonth() + 1) var raw="index.html" var str=escape(raw) document.cookie = "cookie1=" + str + "; expires=" + theDate.toGMTString() } //STOP-->
A better way, but maybe an overkill for a simple script like that, would be to use a server-side database and scripting language (eg PHP and MySQL) to let users create usernames and passwords, and then log in. All the info would then be stored in the database. That'd mean that they could still find where they were up to if they were on a different computer, or they had javascript or cookies turned off. However, you'd need the database stuff running on your server.

Look for online tutorials for PHP and MySQL (they tend to go together) if you want to try this method. I found them very easy to pick up (I've been using them a few months, and my first full site goes live on Friday! Check http://www.scifiminds.net after then.)

Amorya

[edit]Found a bug in your forum code, guys - it parsed out the whole of my code example, instead of replacing < with & lt; and > with & gt;.[/edit]
What the nerd community most often fail to realize is that all features aren't equal. A well implemented and well integrated feature in a convenient interface is worth way more than the same feature implemented crappy, or accessed through a annoying interface.
     
Junior Member
Join Date: Jul 2002
Location: Hang Loose, Hawaii
Status: Offline
Reply With Quote
Aug 15, 2002, 12:57 AM
 
javascript should be enough, though i've never worked w/ cookies in javascript.

you could set it up so the book's page/chapter is recorded in the cookie and when the user returns to the index page, he/she gets redirected to the last page they were in with location.href = /book/chapter/page.html
Can I have that cookie?
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Santa Fe
Status: Offline
Reply With Quote
Aug 16, 2002, 10:12 AM
 
Webmonkey's Advanced JavaScript Tutorial offers a good overview of using JavaScript to handle cookies.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:09 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2