Recently opened Sina scarf, whim, want to do a browser plug-in to achieve text news, such as the forwarding of the plug. This thought should use C + + to write a plug-in (C # so big Shell sometimes really let a person headache), but Google a bit, the luck really good, search, a few about IE plug-in development. Using JavaScript, and adding the registry can be completely done. Plugins are written in JavaScript, which is not to say that the browser itself is supported without additional installation. Add registry manually can add, but trouble so write a batch handle.
1: Add registry: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\menuext\<menu text> Set default value to HTML file path, Add value contexts to) 0xf3.
2:code: Explained in MSDN http://msdn.microsoft.com/en-us/library/aa753589 (v=vs.85). aspx. MSDN Original: Set The default value of the key to the URL of the "page that contains" script you want the context menu entry to Execute. This script can obtain to the parent window object, the screen where the context menu item is executed, from the Menuargumen TS property of the external object.
Presumably, we can use the Window.external.menuArguments object to get the internal information, such as window,document these commonly used objects. So we can start right away, three to five and two minutes to get it done (the code is simple and straightforward):
Copy Code code as follows:
<script LANGUAGE = "JavaScript" >
var owindow = window.external.menuArguments;
var odocument = owindow.document;
var oselect = odocument.selection;
var oselectrange = Oselect.createrange ();
var snewtext = oselectrange.text;//.substring (0,140);
var title=snewtext.length = = 0?odocument.title:snewtext;
if (title.length>0) {
Owindow.open ("http://service.weibo.com/share/share.php?title=" +encodeuricomponent (title) + "&url=" + encodeURIComponent (Odocument.url) + "&source=" +encodeuricomponent ("broken
Wolf ") +" &appkey=1027675428&sourceurl= "+encodeuricomponent (Odocument.url));
}
</SCRIPT>
Look at an effect:
Disadvantage: Here is simply the content of this value below, has not found the way to get the selected HTML or object, is looking for, if you know please do not hesitate to enlighten. I am going to be able to parse out videos, pictures, etc., to send.
Download "Direct Click Batch operation, restart IE"
Reference documents:
http://msdn.microsoft.com/en-us/library/aa753589 (v=vs.85). aspx
Http://blogs.msdn.com/b/oldnewthing/archive/2004/05/24/140283.aspx