K-Meleon

KMeleonWiki > Documentation > Tutorials > LinkFromIEtoKMeleon
(Tutorial by Brian (bst82551)

Opening Links and Pages in K-Meleon from Internet Explorer


Well, there are many easy ways of getting Internet Explorer to open up a link or a URL from K-Meleon, but not many ways of opening up links and URLs in K-Meleon from Internet Explorer. Today, I will demonstrate a method I used to incorporate this feature into Internet Explorer. If you do not feel comfortable editing the registry, I would not recommend continuing with this tutorial. There are two parts... creating the files and editing the registry.

Creating The Files

1. The first thing you need to do is make sure Internet Explorer is updated. I'm currently on Windows XP SP2 with IE 6.0 installed. I'm not positive about whether this will work in previous versions of Internet Explorer, but you are welcome to try still... but I am not responsible for the problems it may cause. You can ask for help on these forums if such a thing occurs and we will most likely find a way to help you out, but I doubt it would cause any problems.

2. There are two files you will need to create, "open.html" and "link.html". To create these files, open up the folder in which you installed K-Meleon (default is "C:\Program Files\K-Meleon\"). You will then need to click (File > New > Text Document). Create another text document. You should now have two empty text documents sitting in your K-Meleon directory.

3. If the files are named "New Text Document.txt" and "New Text Document (2).txt", we are in luck as you do not have Windows set to hide extensions. If you notice that the ".txt" part is missing, in the same window that you have the two files, go to (Tools > Folder Options > "View" tab > uncheck "Hide extensions for known file types" > click "OK" button). Your problem with the ".txt" being gone should now be fixed.

4. Rename the files to "open.html" and "link.html". You may get a message asking if you are sure if you want to change the file extension. Click "Yes". Right click on each of the files and click "Edit". This should open up two Notepad windows. Copy and paste the code below into the corresponding Notepad window. Please note that the code below should be modified if you did not install K-Meleon to the default directory. Simply change the C:\\Program Files\\K-Meleon\\ to whatever your directory is. Make sure to use double backslashes, just the same as I do. To to (File > Save) for each of the Notepad windows. Close them, and if you like, close the Windows Explorer window which shows your K-Meleon directory as well.

open.html

<SCRIPT LANGUAGE="JavaScript">

var shell = new ActiveXObject?("WScript.Shell");
shell.run("\"C:\\Program Files\\K-Meleon\\k-meleon.exe\" \"" + external.menuArguments.document.URL + "\"");

</SCRIPT>

link.html

<SCRIPT LANGUAGE="JavaScript"> 
function runK(location) {

var shell = new ActiveXObject?("WScript.Shell");
shell.run("\"C:\\Program Files\\K-Meleon\\k-meleon.exe\" \"" + location + "\"");

}

var oWindow = window.external.menuArguments;                
if (oWindow != null) {
        var oDocument = oWindow.document;        
        var sText = null;        

        var oEvent = oWindow.event;                                
        if ((oEvent.type  "MenuExtUnknown?") || (oEvent.type  "MenuExtImage?") || (oEvent.type == "MenuExtAnchor?")) {
                var oElement = oDocument.elementFromPoint(oEvent.clientX, oEvent.clientY);
                var oAnchor = oElement;
                while ((oAnchor.tagName != "A") && (oAnchor.tagName != "AREA") && (oAnchor.tagName != "HTML")) {
                        oAnchor=oAnchor.parentElement;
                }

                if (oAnchor.tagName"A" || oAnchor.tagName"AREA") {
                        sText = oAnchor.href;
                } else if (oAnchor.tagName"HTML" && oElement.tagName"IMG") {
                        sText = oElement.src;
                }
        }


        if ((sText != null) && (sText.length != 0)) {
                var location = new String(sText);
                runK(location);
        }
}
</SCRIPT>



Editing The Registry

5. This is the fun part! We will now be editing our registry. I would not recommend tweaking any registry settings on your own unless you know what you are doing, as this could cause severe problems with Windows and even cause it to crash. Anyway... go to ("Start" button > Run...) in the run box, type "regedit"... without the quotes, of course. Go to: "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt"

6. Right click on "MenuExt" and go to (New > Key). Create another key. Rename the first key "Open &Link In K-Meleon". Rename the second key "Open In &K-Meleon".

7. You will notice that in the large panel on the right, it says that the Default value has not been set. For "Open &Link In K-Meleon", double click the "(Default)" value and set it as: {your K-Meleon directory (usually C:\Program Files\K-Meleon)}\link.html

8. Click on the "Open In &K-Meleon". Double click the "(Default)" value and set it as: {your K-Meleon directory (usually C:\Program Files\K-Meleon)}\open.html

9. Click on "Open &Link In K-Meleon" and in the big white space under "(Default)", right click and go to (New > DWORD Value). Rename this value "contexts". Double click "contexts" and type 22 with the base set as hexadecimal. To the right of "contexts", you should see "REG_DWORD" and "0x00000022 (34)".

10. Click on "Open In &K-Meleon" and in the big white space under "(Default)", right click and go to (New > DWORD Value). Rename this value "contexts". Double click "contexts" and type 1 with the base set as hexadecimal. To the right of "contexts", you should see "REG_DWORD" and "0x00000001 (1)".

11. Close the Registry Editor and open up Internet Explorer and try it out!

12. FINISHED! If you have set everything up correctly, then you should be able to open up links from Internet Explorer in K-Meleon by right clicking on the links and going to "Open Link In K-Meleon" and to open up the page you are viewing by right clicking on the document and going to "Open In K-Meleon". If something doesn't work right, try retracing your steps. If that doesn't help, pay a visit to the forums.

K-Meleon

(c) 2000-2010 kmeleonbrowser.org. All rights reserved.
design by splif.