Microsoft Edge Copy Title and URL of a Web Page [Bookmarklet]

There are several third-party extensions out there to copy webpage title and address, for browsers like Chrome, Firefox and others. Here is a neat trick to add your own Copy Title & URL bookmarklet for Microsoft Edge.

Copy Title and URL Bookmarklet for Microsoft Edge

In Microsoft Edge (Chromium), create a bookmark to a sample site.

Then replace (edit) the URL of the bookmark with the following target:

javascript:(function() { function copyToClipboard(text) { if (window.clipboardData && window.clipboardData.setData) { /*IE specific code path to prevent textarea being shown while dialog is visible.*/ return clipboardData.setData("Text", text); } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) { var textarea = document.createElement("textarea"); textarea.textContent = text; textarea.style.position = "fixed"; /* Prevent scrolling to bottom of page in MS Edge.*/ document.body.appendChild(textarea); textarea.select(); try { return document.execCommand("copy"); /* Security exception may be thrown by some browsers.*/ } catch (ex) { console.warn("Copy to clipboard failed.", ex); return false; } finally { document.body.removeChild(textarea); } } } var markdown = document.title + ':' + '\r\n' + window.location.href; copyToClipboard(markdown); })();

microsoft edge chromium - copy title and url

Visit a website and click on the bookmarklet. It will copy the title and the URL of the current webpage, in the following format:



Microsoft Edge Copy Title and URL of a Web Page [Bookmarklet] » Winhelponline:
https://www.winhelponline.com/blog/edge-copy-title-url-web-page-bookmarklet/

Credits to bradleybossard/titleUrlMarkdownClip.js — Bookmarklet to copy current page title and url

The above javascript code also works on Google Chrome, Firefox, and other browsers.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

3 thoughts on “Microsoft Edge Copy Title and URL of a Web Page [Bookmarklet]”

  1. Hi,

    I think this is a very cool concept, but it doesn’t do exactly the same as MS Edge, however. When I use this on this page, this it the result:

    Microsoft Edge Copy Title and URL of a Web Page [Bookmarklet] » Winhelponline:
    https://www.winhelponline.com/blog/edge-copy-title-url-web-page-bookmarklet/

    In MS Edge, it would have returned the page title as a hyperlink, which I think is more elegant. De you know if this is possible at all with javascript? I am very much a dabbler in it. I tried to change the last bit of the code to this:

    var markdown = document.title; copyToClipboard(markdown.link(window.location.href)); })();

    But then the result is this:

    Microsoft Edge Copy Title and URL of a Web Page [Bookmarklet] » Winhelponline

    Which… would be a hyperlink in HTML, but is not exactly what I’m trying to do here.

    Anybody has any idea how to do this / if it’s possible?

    Reply

Leave a Comment