?
Solved

Bookmark this page

Posted on 2005-04-16
3
Medium Priority
?
253 Views
Last Modified: 2013-12-24
Hello,

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?

thanks
cmaorg
0
Comment
Question by:cmaorg
3 Comments
 
LVL 12

Expert Comment

by:mmc98dl1
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)
  {
   window.external.AddFavorite(urlAddress,pageName)
  }
  else
  {
   alert("Sorry! Your browser doesn't support this function.");
  }
 }
// -->
</script>

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
0
 
LVL 5

Accepted Solution

by:
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.
0
 
LVL 5

Expert Comment

by:kkhipple
ID: 13808345
you might want to try the following:

<CFSET CurrentURL = 'http://' & CGI.SERVER_NAME & CGI.SCRIPT_NAME>
0

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