Bookmark this page

Posted on 2005-04-16
Medium Priority
Last Modified: 2013-12-24

I am looking for a script that would allow users to bookmark a page. The problem is that the link to bookmark the page is in an include file so I would want it to automatically determine the current page the user is on. I cannot prepopulate the link as there are many pages on my site and the majority of them are static. Some are dynamic however. Can someone help me with this?

Question by:cmaorg
LVL 12

Expert Comment

ID: 13799521
to do this you would want a bit of javascript - this is easy in IE, but I have never come across a script that works on all browsers.

Try this:

This bit should go in the header or footer file of you site.

<Script Language = "JavaScript" Type="Text/JavaScript">
<!--  Hide script from older browsers
 var urlAddress = " http://www.yourdomain.com/#cgi.query_string#";
 var pageName = "Title of the page";

 function addToFavorites()
  if (window.external)
   alert("Sorry! Your browser doesn't support this function.");
// -->

Place this wherever you want the link to appear:

Click <a href="javascript:addToFavorites()">here</a> to bookmark this story!

Instead of putting in a static domain here I used http://www.yourdomain.com/#cgi.query_string# to give me the exact page I am on.  Hopefully you use dynamic titles, so you can replace

Accepted Solution

umbrae earned 2000 total points
ID: 13801704
I think what you want is:

http://www.yourdomain.com/#cgi.script_name#<cfif len(cgi.query_string) NEQ 0>?#cgi.query_string#</cfif>

query_string just contains the dynamic data, not the actual pathname and filename.

Expert Comment

ID: 13808345
you might want to try the following:


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question