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); })();
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.
Instructions for the old Microsoft Edge
Open Microsoft Edge, visit a website, and add it to the Favorites bar. Name the favorite as Copy Title & URL, or anything as you’d like.
Now, we’ll change that favorite’s target to a javascript code, which copies the page title and URL of the current tab. As of Windows 10 Fall Creators Update you can edit the URL of an existing bookmark in Edge. To do that, right-click on the bookmark and click Edit URL. Type in the following javascript code and press ENTER:
javascript:window.prompt("Copy Title & URL",document.title + " : " + location.href);void(0);
The above javascript code gets the title and website address of the current webpage and shows it in a text box which you need to copy (CTRL + C)
Start Microsoft Edge, visit a website, and then click the Copy Title & URL bookmarklet you created.
You’ll be shown the following prompt with a text control box, showing the title, which is followed by the URL of the webpage. The text range is automatically selected for you.
Due to security restrictions in the old Microsoft Edge web browser, javascript can’t copy stuff to the clipboard directly without the user’s consent, and hence the additional prompt above. Likewise, a new line or carriage return doesn’t seem to work in Edge. So the title and URL will be outputted in a single line as below:
Lifehacker - Tips and downloads for getting things done : http://lifehacker.com/
All you need to do is press Ctrl + C to copy the text to the clipboard and dismiss the dialog by clicking OK or pressing the ESC key.
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!
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:
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?
I jsut realized the HTML code made the hyperlink when the comment was published, but it wouldn’t work if I pasted it in an email or word document or something, it would like like this (hopefully this works this time):
“Microsoft Edge Copy Title and URL of a Web Page [Bookmarklet] » Winhelponline“
Thanks a million! LOVE IT!
Also, it would be great if there was a simple button to share this post!