Copy selected text with links-Collection of common programming errors
One solution might be to transform every link on the page into the desired format. This could be done using Greasemonkey in Firefox and a custom UserScript. Alternatively, Tampermonkey for Chrome might work as well but I do not use it so I cannot verify that. The downside to this solution would be that you would want to enable it only when needed because leaving it enabled for regular web browsing would distort the layout of page elements such as headers, footers, and sidebars.
Download Greasemonkey for Firefox OR Download Tampermonkey for Chrome
The following UserScript can be saved into a *.user.js file (for example: tmpscript.user.js) and then the file can be dragged into Firefox after Greasemonkey has been installed to install the UserScript.
// ==UserScript==
// @name Transform All Links
// @namespace myscripts
// @description Transforms link to { link | href }
// @include http*
// @version 1
// @grant none
// ==/UserScript==
try{
transformAnchors();
}catch(err){
alert("error#" + err.number + " name: " + err.name + "\n"
+ "message: " + err.message + "\n"
+ "description: " + err.description);
var errmsg = "";
for (atr in err) {
errmsg = errmsg + atr + " = " + err[atr] + "
\n";
}
alert(errmsg);
}
function transformAnchors() {
//get every anchor node
var anchornodes = document.getElementsByTagName("A");
//transform every anchor
for (var i=0; i
Originally posted 2013-11-19 13:19:07.