https support and URL copy

Jun 29, 2011 at 11:23 AM

Very nice feature indeed! But it doesn't work properly for https secured sites. Change the parseUrl function to:

// Function that parses the Url
// and gets the third match (path)
function parseUrl(data) {
    var e = /^(http:\/\/|https:\/\/)?([^:\/\s]+)((\/\w+)*(\/)?)$/;

    return (data.match(e)) ? RegExp.$3 : "";

And when you want only the URL to be copied, not the document name in front of it, change this line:

line = line.concat(control.text(), ' - ', copyUrl, '\n');


line = line.concat(copyUrl, '\n');

Jun 30, 2011 at 9:45 AM

Thanks for the information. The code is open for all to contribute. :)

Jul 19, 2011 at 11:39 AM

No problem. I noticed another error when you're using the Office WebApps in 2010; in that case the Wordviewer.aspx URL is being copied which is probably not what you want. Also the URL formatting seems to fail then.

Isn't the method the SharePoint default "send link by e-mail" method available to get the correct URL for the item? That way you could skip your entire URL method and just copy that output to the clipboard. That should be foolproof tested I guess.