Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Drag and drop link idiosyncrasies with web browsers Apps
I was recently found out about the magic of drag and drop (hey, I was a fairly late switcher!). One of the more intriguing things I found was how drag and drop operates with links from a web page (at least when using Safari).

If you simply drag a link from a web page to an open text editor, it pastes the URL of the link to the open document. If you highlight the text around a link, including the link itself, then drag and drop it, you end up pasting the HTML coding used within that block of text (<a href...> tags and all), supposing of course, your text editor is capable of displaying HTML pages. This seemed to work with Microsoft Word and TextEdit, but not TextWrangler. For Text Wrangler, I simply got the text, but not embedded the embedded HTML tags. I guess this can be useful in copying portions of a web page.

This only seems to work with text-based links. If you drag and drop a graphic-based link, it simply copies the graphic, although doing this in TextWrangler brings up the URL for the link.
  • Currently 2.67 / 5
  You rated: 2 / 5 (6 votes cast)

Drag and drop link idiosyncrasies with web browsers | 7 comments | Create New Account
Click here to return to the 'Drag and drop link idiosyncrasies with web browsers' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Drag and drop link idiosyncrasies with web browsers
Authored by: IanWalker on Mar 10, '05 11:19:26AM

I played with this, and as I suspected, the reason this doesn't work with TextWrangler is beacuse TextWrangler is only a plain-text editor. I don't use Rich text at all with TextEdit (I set it to default to plain-text) and with that setting, it doesn't work. Switch it to Rich text? wham - it works exactly as described. With plain text it still copies the url if you just drag that, so it's still really useful.


[ Reply to This | # ]
Drag and drop link idiosyncrasies with web browsers
Authored by: loticus on Mar 10, '05 12:33:23PM

Also, if you use more than one browser in parallel (I have to switch into Firefox or Camino for web development occasionally), you can drag a link into the browser window to open it. This only works if you drop it on the window itself (after Command+Tabbing to get there); dragging to the Dock icon doesn't seem to cut it.

[ Reply to This | # ]
Drag and drop link idiosyncrasies with web browsers
Authored by: taxi on Mar 10, '05 10:18:38PM

Dock icons can only handle file objects.

You cannot, for instance, drag a clipping of text, or a url, onto a dock icon.

I came across this shortcoming of MacOSX when first using NewsFire...the developer informed me that this is not possible.

[ Reply to This | # ]
Drag and drop link idiosyncrasies with web browsers
Authored by: osxpounder on Mar 10, '05 02:55:23PM

Hmm, not happening for me -- perhaps there's more to this than we've discovered yet.

My TextEdit prefs are set to make plain text files, by default, so I had to change a new, blank document to a Rich Text file to try it both ways.

When I drag a link into a plain text document, I get the URL [no <a href> tags]. When I drag a link with some surrounding text, I get only text.

If the document is RTF: dragging a link gives me the URL. Dragging a selection of the link, with some text surrounding it, reproduces the link in my RTF document as it appears on a web page [i.e., it appears as clickable, blue text].

I also tried changing my preferences in TextEdit, so that it defaults to creating RTF files, then restarting TextEdit. No difference.

It'd be great to get the tags -- that could save me some typing in my work.


[ Reply to This | # ]
Drag and drop link idiosyncrasies with web browsers
Authored by: imagine on Mar 10, '05 03:17:52PM

Overriding what gets dropped when doing a drag 'n drop can be done with an APE module. I've added it to my development ideas list (not that I'll necessarily get around to it any time soon).

[ Reply to This | # ]
Drag and drop link idiosyncrasies with web browsers
Authored by: davidm on Mar 13, '05 11:28:43AM

Like "osxpounder," I couldn't get this to work as described, in TextEdit OR in Word.

TextEdit Help told me to go to the preferences pane and select "Ignore rich text commands in HTML files." I did so, quit and restarted, and tried again, but it still didn't work.

This is what DID work for me: drag and drop into a new TextEdit file (in RTF mode). Then save the file somewhere and close it. Then open it again, using the Open command from the File menu. In the dialog, check "Ignore rich text commands," and open your saved file. You will see the HTML code. (Note: if you open the file by dragging it to the dock, you won't get the open dialog and won't be able to check the "Ignore rich text commands" box.)

This takes a lot longer, but since I can't get it to work as described, it's all I've got! (Unless someone else can find what I'm doing wrong.)

[ Reply to This | # ]
Drag and drop link idiosyncrasies with web browsers
Authored by: jeff_lamarche on Mar 14, '05 09:12:53AM
This is not really unqiue to browsers; it's simply an artifact of the way the pasteboard server (clipboard) works in OS X. When a copy or cut is requested of a program, the program tells the pasteboard server what kind of information it has for the pasteboard. It can (and most programs do) specify multiple types, including custom types, along with a prioritization of those types.

This allows a program to retain special formatting with cut and pastes within the program, yet retain full compatibility with cross-application cut and paste with any foreseeable external application. It may seem a little mysterious, but once you understand the basic mechanism, it's pretty straightforward. TextWrangler is a pure text editor, and as such, is not going to request RTF, encoded HTML, or images. TextEdit is likely going to accept stylized text and images. If you were in an image editing program, it might do nothing, or it might paste the rendered stylized text, or something else.

[ Reply to This | # ]