CopyUrlPlus provides the means of extracting the title of a webpage along with the url and selected text for reuse in documentation in HTML pages, or email.  Copy URL + is certainly one of my favorite extensions, and this page documents some of my own use and customizations.  « Additional Favorite Extensions in big list.


COPYURL Plus, format a link for HTML

Location: http://www.mvps.org/dmcritchie/firefox/copyurlplus.htm      
Home page: http://www.mvps.org/dmcritchie/firefox/firefox.htm
[View without Frames]

COPYURL Plus (#intro)

Creation of <a href=""></a>   «  (install CopyURL plus text editor extension, right-click(#copyurl)
   Copy URL + Title
   Copy URL + Selection
   Copy URL + Title + Selection
 Copy URL + <dt>title<dd>selection / url
   Copy URL + <a href=...>...</a>
   Copy URL + <a href=... title=selection>...</a>
   Copy URL + <a href=...>...</a>, selection
   Convert TEXT to HTML code
   DIV + <a href=...>...</a>, selection
URL+ submenu
(based on additions to user.js below)

! Compatibility Warning!  A user modified ver 1.3.2 for use with Fx2 can be installed without turning off compatibility testing.  Read more about overriding compatibility testing.  But first check for availability of a more recent version of CopyURL Plus.

The CopyURL+ extension for copying and pasting the link title, and url from the line anchor information, along with the current selection, is easily customized to format this information using COPYURL patterns of your choice to paste into other applications.  Some suggested customization patterns are included for blogging, HTML, plain text for email, and other uses have been provided.

There are 3 builtin menu items, you will always see the first, but the second and third only appear if you have a selection. 

B1:  Title/url -- available, even if url has no Title
B2:  Selection/url -- available if there is a selection
B3:  Title/selection/url -- available if there is a selection

CopyURL+ Additions to user.js   (#additions)

Customizations are a personal thing these are mine.  You should have read the author's writeup on customizations [ mozdev.org - copyurlplus: customize, by Philip Mateescu]. 

There is no check on user customization as to whether you have made a selection, or are rightclicking on a link so you may get a empty string in your results. 

Forward slashes in the label (display) represent new line. 

Backward slahses represent special (escape) characters, or the exact character indicated in some cases. Use of \n indicates a new line in the output -- does not effect HTML itself.  Use of \" indicates a doublequote, don't know what \1 means but have seen it introduced into the output of htmlified url such as from a Google Search and it does not appear to effect usage.

(code below was copied from user.js and prepared for this HTML document using some Excel VBA coding) -- [ complete code]

While you can read most of this document on half of a 768 x 1024 screen, it would be best to use full width when looking at code due to line wrapping, or intentional newline inflicted for readability. Each of the following lines of code begins with user_pref.

— — —

 
This is a simulation of one of the provided definitions that you do not code:
 
user_pref("copyurlplus.menus.1.copy", "\n %TITLE%\n \"%SEL%\"\n -- %URL%\n\n");
user_pref("copyurlplus.menus.1.label", "Copy URL + Title / Selection");

 
Example of my definitions within profile's user.js follow:  (copy of entire user.js actually in use)
 (Mozillazine KB article on user.js file, it is a file that you must create the first time)
 
user_pref("copyurlplus.menus.1.copy","<dt><b>%TITLE_HTMLIFIED%</b>,</dt>\n<dd>%SEL_HTMLIFIED%\n<br><a href=\"%URL_HTMLIFIED%\">%URL_HTMLIFIED%</a></dd>\n");
user_pref("copyurlplus.menus.1.label", "Copy URL + <dt>title<dd>selection / url");
user_pref("copyurlplus.menus.2.copy", "<a href=\"%URL_HTMLIFIED%\">%TITLE_HTMLIFIED%</a>");
user_pref("copyurlplus.menus.2.label", "Copy URL + <a href=...>...</a>");
user_pref("copyurlplus.menus.3.copy", "<a href=\"%URL%\">title=\"%SEL_HTMLIFIED%\">%TITLE_HTMLIFIED%</a>");
user_pref("copyurlplus.menus.3.label", "Copy URL + <a href=... title=selection>...</a>");
user_pref("copyurlplus.menus.4.copy", "<a href=\"%URL_HTMLIFIED%\">%TITLE_HTMLIFIED%</a>,>%SEL_HTMLIFIED%");
user_pref("copyurlplus.menus.4.label", "Copy URL + <a href=...>...</a>, selection");
user_pref("copyurlplus.menus.5.copy", "%SEL_HTMLIFIED%\n\n");
user_pref("copyurlplus.menus.5.label", "Convert TEXT to HTML code");
user_pref("copyurlplus.menus.6.copy", "<div class=\"offset\"><a href=\"%URL_HTMLIFIED%\">%TITLE_HTMLIFIED%</a>, %SEL_HTMLIFIED%</div class=\"offset\">\n\n");
user_pref("copyurlplus.menus.6.label", "DIV URL + <a href=...>...</a>,selection");

Use of offset requires a CSS style definition for offset.  If you look in the source for firefox.htm you will see the following three lines.  Incidentally the OFFSET was used above and you will notice it for continuation lines above.
.offset {margin-left:+2em; text-indent:-2em;}
.outdent {margin-left:-0; text-indent:-1.2em;}
.indent {margin-left:+0em; text-indent:+2em;}

——
Additional examples in Copyurl, Links with Style later in this webpage.
An easier way of updating user.js than you've probably seen elsewhere.

Escape Characters (#escape)

\n     new line         x'10'
\r     carriage return  x'0A'
\\     backslash        x'5C'
\t     tab              X'09'   
\xhh   hex characters   x'hh'
Don't know how much of this applies but it is one of many such such articles describing similar escape characters:  3.2 Escape Sequences in the GNU Awk User's Guide.

Plain Text Formatting   (#plain)

 (-)  Copy URL + Title
 (-)  Copy URL + Selection
 (-)  Copy URL + Title + Selection
 (1)  Copy URL + <dt>title<dd>selection / url
 (2)  Copy URL + <a href=...>...</a>
 (3)  Copy URL + <a href=...title=selection>...</a>
 (4)  Copy URL + <a href=...>...</a>, selection
 (5)  Convert TEXT to HTML code
 (6)  DIV Offset + <a href=...>...</a>, selection
URL+ submenu
(based on additions to user.js below)
In the interest of being able to update this at all, I will just list the sample output that may or may not match the personalized additions above.
— — —


Builtin plain text samples

mozdev.org - copyurlplus: customize
http://copyurlplus.mozdev.org/customize.html

"As of version 1.1, Copy URL+ allows you to add your own menu entries. By simply adding a couple of entries to the user.js file, you can create countless custom entries"
http://copyurlplus.mozdev.org/customize.html

mozdev.org - copyurlplus: customize
"As of version 1.1, Copy URL+ allows you to add your own menu entries. By simply adding a couple of entries to the user.js file, you can create countless custom entries"
http://copyurlplus.mozdev.org/customize.html


User plain text samples
(1) Copy URL + Selection / *RLINK* / Title
"\n%SEL%\n -- %RLINK%\n ref: %TITLE%\n ref: -- %URL\n"

Requires a selection (1st line), and the cursor must be on a link (Remote Link) when right clicked, if the cursor is not o a line there will be no filename after the two hyphens.  Example created from an entry in the Related area.

keyword shortcuts (onsite), examples of keyword shortcuts used in a separate folder, and how to find them if someone sprinkled them throughout the bookmark.html file. in the profile directory.
-- http://www.mvps.org/dmcritchie/firefox/kws.htm
ref: COPYURL Plus, format a link and selection to paste into HTML
ref: -- http://www.mvps.org/dmcritchie/firefox/copyurlplus.htm
(2) Copy URL + Title / Selection -- 60 articles
"\n %TITLE%\n \"%SEL%\"\n -- %URL%\n"

Requires a selection to work properly, this is very similar to the builtin plain text (selection version), but have placed a newline at the beginning and at the end, since it will stand by itself in a text document, and have placed two hyphens in front of the urlname, which helps readability and it prevents merger reply character if used in email.
COPYURL Plus, format a link and selection to paste into HTML
"format this information using COPYURL patterns of your choice"
-- http://www.mvps.org/dmcritchie/firefox/copyurlplus.htm#preparation

HTML formatted (Rich Text) (#html)

In the interest of being able to update this at all, I will just list items (3) through (7) with the Sample output that may or may not later match the personalized additions above
mozdev.org - copyurlplus: customize,
As of version 1.1, Copy URL+ allows you to add your own menu entries. By simply adding a couple of entries to the user.js file, you can create countless custom entries
http://copyurlplus.mozdev.org/customize.html   — (3) is for insertion within a dictionary list (<dl>...</dl>)
mozdev.org - copyurlplus: customize   — (4) This is the basic reference for HTML usage

mozdev.org - copyurlplus: customize   — (5) Selection is internalized with TITLE

Firefox Customizations, (onsite), customizations used, problems encountered, extensions in use (or previously used) as reported in COPYURL Plus, format a link and selection to paste into HTML   – (6) Requires a selection AND the cursor on a (Remote) Link.

mozdev.org - copyurlplus: customize, As of version 1.1, Copy URL+ allows you to add your own menu entries. By simply adding a couple of entries to the user.js file, you can create countless custom entries
  — (7) Selection is externalized, appears after the link and a comma

Copyurl and Outlook Express (#oe)

Plain Text into Outlook Express


In Outlook Express you can send out as text only or as HTML formatted text.

The easiest is as Plain Text, simply make a selection and paste from one of the Plain Text choices.

Copy material into Notepad and save as HTML (file:\c:\temp\temp.htm)

Firefox update squashes security bugs | Tech News on ZDNet
 "Firefox 1.0.5, released Tuesday, patches a dozen bugs in the open-source Web browser, some of them "high risk," said Chris Hofmann, director of engineering at Mozilla. High-risk problems typically allow an intruder to commandeer a PC or expose the user's data."
-- http://news.zdnet.com/2100-1009_22-5785672.html?tag=nl.e589
 

The Copyurl material in user.js might be modified as follows the above purpose (60 links)
Because of the extensive number of links that might be stacked under one another a newline, \n, has been inserted at the beginning and at the end of the definition.
user_pref("copyurlplus.menus.1.copy", "\n%TITLE%\n \"%SEL%\"\n -- %URL%\n");
user_pref("copyurlplus.menus.1.label", "Copy URL + Title / Selection -- 60 articles");

you can copy a selection of HTML formatted text and paste into Outlook Express

You can paste into notepad save as HTML (.htm), view in Firefox or Internet Explorer. then paste into your Outlook Express with HTML formatting. You don't need to add other HTML tags like HTML, BODY . Though you might want to add <P> or modify your customized copyurlplus.xml and since 60 links are being created the extra steps is trivial because it is done only once.
 
Copy material into Notepad and save as HTML (file:\c:\temp\temp.htm)
<P>
<a href="http://news.zdnet.com/2100-1009_22-5785672.html?tag=nl.e589">Firefox update squashes security bugs | Tech News on ZDNet</a>, Firefox 1.0.5, released Tuesday, patches a dozen bugs in the open-source Web browser, some of them "high risk," said Chris Hofmann, director of engineering at Mozilla.

 
Open as HTML and copy what you want, and then paste into Outlook Express formatted as HTML

Firefox update squashes security bugs | Tech News on ZDNet, Firefox 1.0.5, released Tuesday, patches a dozen bugs in the open-source Web browser, some of them "high risk," said Chris Hofmann, director of engineering at Mozilla.

Copyurl, Links with Style (#style)

While an overall style for the sheet would probably work better, this was emulating an example.  There were at least 4 different types used, I've included 3 below.
 
STYLE added to the HTML document, to be used by the generated coding.
<style type="text/css">
.offset {margin-left:+2em; text-indent:-2em;}
.item {font-size: smaller; font-weight: bold; font-family: Arial; color: #000080;
vlink: #000000; link: #000000; alink: #000000}
.related {color: #800000;}
.see {color: #800000;}
</style>

 
Copyurl Additions for use with Style coding shown above.

user_pref("copyurlplus.menus.8.copy", "<div class=\"item\"><a href=\"%URL_HTMLIFIED%\">%TITLE_HTMLIFIED%</a></div>\n");
user_pref("copyurlplus.menus.8.label", "ITEM*** -- <a href=...>...</a>");

user_pref("copyurlplus.menus.9.copy", "<div class=\"item\"><span class=\"related\">&nbsp;&nbsp;&nbsp;Related:&nbsp;</span> <a href=\"%URL_HTMLIFIED%\">%TITLE_HTMLIFIED%</a></div>\n");
user_pref("copyurlplus.menus.9.label", "**Related -- <a href=...>...</a>");

user_pref("copyurlplus.menus.10.copy", "<div class=\"item\"><span class=\"see\">&nbsp;&nbsp;&nbsp;See also:&nbsp;</span> <a href=\"%URL_HTMLIFIED%\">%TITLE_HTMLIFIED%</a></div>\n");
user_pref("copyurlplus.menus.10.label", "**See also-- <a href=...>...</a>");

Generated Examples as Displayed. 
Use selection and display selection source on the context menu to see the actual HTML coding.
Items in the news
http://home.att.net/~news_items/Items_in_the_news.html
Caterpillars Invade New Mexico Forests had to change title subject

 
Generated HTML code         — (code below was prepared using some Excel VBA coding)
word-wrap:break-word;   — used to force mozilla to wrap at width of table for preformatted text (<code>, <pre>, <tt>>)
<div class="item"><a href="http://www.enn.com/today.html?id=8222">ENN:
Environmental News Network [[Today's News Full Story ]]</a></div>

<div class="item"><a href="http://www.nj.com/news/gloucester/index.ssf?/base/news-0/1121156125123570.xml
&amp;%5C1coll=8"> DuPont agrees to preserve 1,875 acres</a></div>
<div class="item"><span class="see">&nbsp;&nbsp;&nbsp;See also:&nbsp;</span> <a href="http://www.ens-newswire.com/ens/jul2005/2005-07-11-09.asp#anchor1">Environment News Service ENS Latest Environmental Information Education Current Issues RSS</a></div>

<div class="item"><a href="http://www.latimes.com/news/printedition/asection/la-na-toxics13jul13,1,6092909.story?
coll=la-news-a_section&amp;%5C1ctrack=1&amp;%5C1cset=true">EPA Is Faulted as Failing to Shield Public From Toxins</a></div>

<div class="item"><span class="related">&nbsp;&nbsp;&nbsp;Related:&nbsp;</span> <a href="http://www.ens-newswire.com/ens/jul2005/2005-07-13-09.asp#anchor5">Environment News Service ENS Latest Environmental Information Education Current Issues RSS</a></div>

<div class="item"><a href="http://www.eurekalert.org/pub_releases/2005-07/ou-spd071105.php">Study: Predatory dinosaurs had bird-like pulmonary system</a></div>

<div class="item"><span class="see">&nbsp;&nbsp;&nbsp;See also:&nbsp;</span> <a href="http://www.nature.com/news/2005/050711/full/050711-8.html">news @ nature.com&nbsp;-&nbsp;Dinosaurs breathed like birds&nbsp;-&nbsp;Fossil bones show air pockets for high-energy lifestyle.</a></div>

Note that one item had to be changed, for this type of data it might be better to use a selection (%SEL_HTMLIFIED%) from within the data rather than the title (%TITLE_HTMLIFIED%).

Creation, Updating User.js   (#userjs)

An example of my own user.js can be found as a text file on my site.  Much of the code consists of additions for the "CopyURL Plus" extension, and most unrelated content my user.js example would probably be described on my page Firefox 3 Introduction (Presentation Outline)

Locating your profile was greatly simplified in Firefox 3.5, as all you need to do now is
Help [Alt+H] → Troubleshooting Information... → "Open Containing Folder"

The rest of this topic describes a simpler form of the horrible round about way you had to use to find your profile.  Don't forget about backing up all of your user data.

Your code to customize Copyurl must be placed into user.js in your Firefox profile.  I would not recommend installing ChromeEdit nor the method for finding your profile mentioned in these documents but you should read and be familiar with Firefox Help: Editing Configuration Files and Firefox Help: Tips & Tricks

Once you're set up, all subsequent updates to user.js can simply be done with You can update userps.js from Notepad, recycle Firefox (take Firefox down and bring it back up) so changes are in effect.  You do not need to exit from Notepad so it is easy to test your changes.  A bad update in your user.js or chrome.css can prevent Firefox from coming up so a backup of your entire Firefox profile) would be advisable when you do backups.

Preparation of HTML code (#preparation)

This page was getting difficult to prepare the HTML with recoding of HTML code, so a little Excel VBA code was written to handle conversion of data in the clipboard back to the clipboard.  Specifically converts plain text to htlm or html text to show code.
 
*
* Decode HTML
The basic conversions are shown below: (the code was run through itself for this list)

slnk = MyDataObj.GetText
slnk = Replace(slnk, "&", "&amp;")
slnk = Replace(slnk, Chr(160), "&nbsp;")
slnk = Replace(slnk, "<", "&lt;")
slnk = Replace(slnk, ">", "&gt;")
slnk = Replace(slnk, Chr(34), "&quot;")
slnk = Replace(slnk, "\n", "<span style=""color: red; font-weight: bold;"">\n</span>")

slnk = Replace(slnk, vbCrLf, "<+$br$+>")
slnk = Replace(slnk, vbCr, "<+$br$+>")
slnk = Replace(slnk, vbLf, "<+$br$+>")
slnk = Replace(slnk, "<+$br$+>", vbCrLf & "<br>")

If redoing this page in the future you can use  CopyURL Plus  itself to convert text to HTML.

user_pref("copyurlplus.menus.7.copy", "%SEL_HTMLIFIED%");
user_pref("copyurlplus.menus.7.label", "Convert TEXT to HTML code");

HTML Peculiarities in this document (#peculiarities)

Getting used to the coding within style sheets.  This has nothing to the with the topic of this page, just with it's preparation.
font-family: "Courier New", "Lucida Console", "Courier", monospace;
font-family: Arial;       – example
Font-size: smaller;         – font-size does not allow negative numbers like the font tag
font-style: italic;       &nbp; – example
font-weight: bold;         – example
word-wrap:break-word;   — used to force mozilla to wrap
        at the width of a table for preformatted text (<code>, <pre>, <tt>>)

Suggestions (#suggestions)

Some possible suggestions: (modified 2005-01-08)
URL      (exists) URL of the current page
TITLE    (exists) TITLE of the current page  
RLINK    (exists) the url (href) supplied in the link  
RTEXT   the text displayed within the link (available in CoLT extension)
RTITLE  the title=  internal to the anchor RLINK  
XTITLE  if possible to go out to the link and get it's actual title   
XSIZE   size of the url download if provided by server (and if available in Firefox extension)
        since it does not include images or other embedded items it is only a guideline.   

CLINK   copy the whole enchilada as is,  same as using   Firefox's
             View Selected Source  and  pick out the actual link from
             and including   ...      which is probably more
             useful for copying from your own web pages since you will
             know exactly what is there.
I don't know how much data can be obtained from a server without actually downloading a file, and something like getting a filesize is available in Internet Explorer bookmarklets but not available in Firefox bookmarklets. 

also partial to someone else's request, Robert Hughes on 2005-10-14 (dead link), that would do what is currently done for the cursor not on a link for all of the open tabs, and how would you invoke that without defining whole new sets.  (see Copy All Urls uses h4 and needs a little tweak to put title first, but it's a fairly decent solution)

Problems   (#problems)

Most complaints seen in comments for this extension, simply are from not reading the documentation with it.  When I installed it runs under Windows, period, it is documented, believe it.  Some don't like the default choices, it is customizable, so make it do what you want.  Of course those that complain about such things did not read Philip's documentation on customization, so they aren't likely to look here anyway. 

Doubled entries in context menus, to fix (#doubled)

prefs.js must be edited with Firefox down, and since you are having a problem would also suggest that you edit user.js while Firefox is down.  When Firefox comes up the user.js entries are copied to prefs.js therefore overriding what may already be there from previous changes via about:config or Tools, Options.  For CopyURL Plus would recommend that use use user.js and not try to to use about:config, if you later use about:config your changes will be lost (overridden by user.js).
  1. Update user.js in profile, if necessary (make sure your entries are here)
  2. Uninstall CopyURLplus
  3. Exit Firefox, and make sure Firefox is not in Task Manager (Ctrl+Alt+Del)
  4. Update prefs.js in profile, removing copyurlplus material that you have in your user.js – I use HTML-Kit as the editor for this.
  5. Bring up Firefox
  6. Reinstall Copy URL plus
  7. recycle Firefox, and check copyurl in context menu

I've not been able to find out how or when doubling occurs as it can go for quite some time before the problem appears.  I was playing with DOM inspector, and with sidebar pages, and also there was a Firefox failure sometime in morning (2006-03-26) and the problem was seen and corrected in the afternoon.

Without reinstalling CopyURLplus the stripped down directions are no longer working not even with a reboot.

%RLINK% was added in last change to CopyURL+ and does not work.  see author's writeup on customizations [ mozdev.org - copyurlplus: customize, and my attempted usage in user.js code.

Example copy copyurlplus entries (#code)

See copyurlplus_example.txt

This page was introduced on July 13, 2005. 
[My Excel Pages -- home]    [INDEX to my site and the off-site pages I reference] 
[Site Search -- Excel]     [Go Back]    [Return to TOP

Please send your comments concerning this web page to: David McRitchie send email comments


Copyright © 2004 - 2006,  F. David McRitchie,  All Rights Reserved