Can Safari copy both the URL and page title during a drag-and-drop?
I frequently want to paste a URL and page title into a document or email message. When I drag and drop a URL from Safari and other browsers (by dragging the URL icon) I see the page title being dragged with the cursor. However, when I drop it in Terminal or in a Gmail message in plain text, I get the URL only and when I drop it in Textedit or in a Gmail message with rich text, I see the title only (with the link). Can I get both?
Solution 1:
Byword seems to do that by default:
It's not really drag and drop, but you could also assign a shortcut to a script like this:
tell application "Safari" to tell document 1
set the clipboard to "[" & name & "](" & URL & ")"
end tell
Solution 2:
If you paste into an OS X app that accepts rich text input (i.e. not a web app like gmail), you'll get the title as text with the URL as the link to that text—try it in TextEdit. If you need the title and URL as plaintext, you could use an AppleScript like this one that will copy the URL and title of the active Safari tab to the clipboard (you may want to change the formatting to your liking).