Click here to Skip to main content
15,891,905 members
Articles / Desktop Programming / Win32

Creating and Installing Internet Explorer Context Menu using C#

Rate me:
Please Sign up or sign in to vote.
3.67/5 (8 votes)
9 Feb 2008CPOL2 min read 65.5K   1.4K   52  
Add an Internet Explorer context menu using an installer class
<SCRIPT LANGUAGE = "JavaScript">

// Get the window object where the context menu was opened.
var oWindow = window.external.menuArguments;

// Get the document object exposed through oWindow.
var oDocument = oWindow.document;

// Get the selection from oDocument.
// in oDocument.
var oSelect = oDocument.selection;

// Create a TextRange from oSelect.
var oSelectRange = oSelect.createRange();

// Get the text of the selection.
var sNewText = oSelectRange.text;

// If nothing was selected, insert some text.
if (sNewText.length != 0){
   alert(sNewText);
}

</SCRIPT>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Other Born Interactive
Saudi Arabia Saudi Arabia
Follow me: http://riadafyouni.blogspot.com

Comments and Discussions