Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
|
You could use a remote xmlHttpObject call to do that when a user use a link in your site to add the bookmark, but not if he use either a keyboard shortcut ar manually drag the link in his/her favorites list.
If you want to do that, the solution is to add an "onclick='javascript :addCount();'" on the link.
As an onclick is always executed before the href, we can use it to launch a remote AJAX call, record the click, and then call the javascript function to add the bookmark in the href.
There is no universal methode to do that, so I won't give you a confusing exemple here, but basically, the steps required are:
1) Set up a backend PHP/JSP/ASP/wathever dynamic language to record the click. Simply make so that on every access, it increas a counter in a table of your database.
2) Write a javascript function that will do the call. Depending of the framework you use (or not), the syntax will differ a lot, report to the user documentation for that.
3) Set up the "add to favorites" bookmark that way:
Code:
<a href="javascript:addBookmark();" onclick="recordClick();">Add to favorites</a>
In this exemple, recordClick() is the javascript function that will do the ajax call, and addbookmark() will be the one that detect which browser it is and call the right method for each. Yep, nearly every browser have his own syntax to that...
__________________
Only a biker knows why a dog sticks his head out the window.
|