NetRyder
Tech Junkie
- Joined
- 19 Apr 2002
- Messages
- 13,256
Cross posting this from my blog...
As I may have mentioned earlier, I'm making it a point to use IE 7 as my primary browser, at least during the beta test period, so that I can report any issues that I find.
Since I've been using Firefox for such a long time, there was one little thing that was bugging me - IE does not include a context-menu item to quickly copy the location/URL of an image on a webpage. This is something I tend to use quite often (to post links to images in emails, IM messages, on forum threads etc.), and the multi-step process of selecting Properties, highlighting the image location and then copying it just wasn't cutting it.
So I posted a wish/suggestion on the beta newsgroups asking for such a context-menu item. Eric Lawrence from the IE team responded to my post and said it's possible to add something like this quite trivially using the MenuExt registry key. I looked up the MenuExt registry reference on MSDN, understood how it works, and wrote this quick little JavaScript blurb that adds a "Copy Image Location" item to the IE context menu. Note that this is not IE7-specific and will work on IE6 as well.
Here's how you do it. Copy the following piece of code into Notepad and save it as a HTML file to any location (I'll use C:\Windows\copyimageurl.html for this example):
Code:<script language="JavaScript"> var image = external.menuArguments.event.srcElement; clipboardData.setData("Text",image.src); </script>
Then you need to create a registry key to point to this file:
1. Start>Run>regedit
2. Navigate to HKCU\Software\Microsoft\Internet Explorer\MenuExt
3. Create a new sub-key and call it "Copy Image Location" (this is the text that appears in the menu)
4. Set the "(Default)" string value to the location of the html file we created - C:\Windows\copyimageurl.html in this example.
5. In the same key, create a new DWORD value called "Contexts" and give it a value of 2 (this means that the menu item appears only when you right click an image)
That's it. Close any existing browser windows and when you open them back up, you should notice a new context-menu item that copies the image location to the clipboard.
Ah, that made life much easier.