Edit Selection Text for IE (level: beginner/intermediate)

I find this quite useful for debugging things in IE, add an 'Edit Selected Text' option to the right click context menu in IE. Just so you can see how things will behavie when different length text is used

You'll need to do the folowing

  • Save the EditSelectedText.html
  • Edit the regisery

step 1:

Save the EditSelectedText.html (right click and 'save target as...') in an appropriate place.

<SCRIPT LANGUAGE="JavaScript" defer>
  function EditSelectionSource(){
  
	var parentwin = external.menuArguments; 
	var doc = parentwin.document;
	var sel = doc.selection;
	var txt = sel.createRange().text;
	sel.createRange().text = parentwin.prompt('Update text',txt); 
	
  }
  
  EditSelectionSource();
</SCRIPT>

step 2:

Dive into regedit and add your menu item, which is a bit scary, normally I wouldnít go anywhere near the Registry but in this case I think itís worth it.

Start > Run > regedit >


HKEY_CURRENT_USER 
	Software 
		Microsoft 
			Internet Explorer 
				MenuExt

In regedit navigate to MenuExt, right click on it and select New > Key call it "Edit Seleced Text" a new text data key will be added, right click on it and select modify, in the "value data" area type in the path to the attached HTML page.

Then add a DWORD name 'contexts' value 10 hexadecimal, results should look somthing like this...

That should do it close regedit quickly, and close all IE browsers.

Alternativly:

If you donít want to go to the bother of crashing your machine and reinstalling the OS, you could just save the javascript as a link, but really, that's not quite so much fun!

Right click on the following link Edit Selected Text and choose Add to Favourites... save it in your Links folder. If your links toolbar is visible, you'll get a "Edit Selected Text" link, now select something on the page and click the link.

- ends -