Even if you do not use IE yourself, maybe you use HTML help or your site has IE users that you want to make life easier for.
Personally, I didn’t have enough of Opera’s ability to highlight a piece of a webpage that is not designed as a link, and click on it as a URL. A little surf on the Internet, I bungled myself such a thing
It turned out even a little more convenient than in Opera - it does not show this menu item if a piece of the URL is highlighted, and in me it is shown for any selected text.
')
The plugin consists of two files: openselection.html and openselection.inf. The first is the actual code of the plugin, the second contains instructions for installing it. If you prefer to read the first documentation on the topic, then you are
on MSDN here , as well as
here .
And here I will give the contents of the files that I have turned out:
openselection.html <Html>
<SCRIPT LANGUAGE = "JavaScript" defer>
var value = external.menuArguments.document.selection.createRange (). text;
var protocols = ['http', 'https', 'ftp', 'mailto'];
function startsWith (s, prefix)
{
return s.substr (0, prefix.length) == prefix;
}
function hasProtocol (s)
{
for (i in protocols)
{
if (startsWith (s.toLowerCase (), protocols [i] + ':'))
return true;
}
return false;
}
if (! hasProtocol (value))
value = 'http: //' + value;
external.menuArguments.open (value, '_blank');
</ SCRIPT>
</ Html>
Here, the main plug-in feature is to use external.menuArguments instead of window - the fact is that a new window is created for the plug-in with a different security context (the script can create, for example, FileSystem object and work with files), and the original window is transferred to external.menuArguments. If you use window, then a new window will open instead of a new tab.
openselection.inf [Version]
Signature = $ CHICAGO $
[DefaultInstall]
AddReg = Add.Settings
[Add.Settings]
HKCU, Software \ Microsoft \ Internet Explorer \ MenuExt \ Open URL ,, 0, "% 01% \ openselection.html"
HKCU, Software \ Microsoft \ Internet Explorer \ MenuExt \ Open URL, Contexts, 0x00010001,0x10
Everything is simple - a new registry key is added, the name of which coincides with the name of the menu item, with two values:
- (deafult) - path to the html file (% 01% indicates the folder where the inf file was launched from)
- Context - when called from where to show this menu item
It is interesting that on the Internet there are traces of attempts to register the text of the plugin in the form of javascript in the registry: links, but this doesn't work for me on IE8.
I would be glad if this thing is useful to someone.