How to use to display my extension's help pages

I noticed that that there is a ko function to launch the Komodo Help dialog.

Can I use it display help pages for my extension?

And if so, can you point me to some notes or samples to show how to do it?

The documentation is a bit light…

Open the Komodo help window.

             - String
          A page tag as defined in toc.xml"path to help page (http(s) or chrome://)","browser");
Function used for opening Komodo built-in help pages defined in toc.xml (or not, @toddw can say more).
I don’t know how to open pages that placed in your add-on :frowning:

There are a few different browser APIs:

var url = "";
// To open a browser view (like an editor tab):, "browser");
// To open in an external (or default) browser:

To locate file inside of an extension:

var afile = Components.classes[";1"].
                    get("ProfD", Components.interfaces.nsIFile);
// Add extensions dir
// Add the extension name
// Add the file name
// Now grab the path
var path = afile.path;

Let us know if you need more info.


And why do not use chrome://extension_name/content/mypage.html where extension_name defined in chrome.manifest (in most cases as first line of manifest file, for example: content extension_name content/)?

Because an external browser will not like that :stuck_out_tongue:

1 Like

Oops, I don’t think about it :smiley:
Also can I write same code as afile.append("extensions").append("").append("docs.html")?

Also in this case I think it would be better if your “Help” window will be opened as new <window> tag/object with XUL/HTML inside :blush:

Thanks, I’ve already concocted a dialog to handle external html pages or pages I’ve put in my extension chrome (see below). I was just thinking that the Komodo help dialog might be more usable (with its nifty contents pane, and navigation and print buttons.) than that strategy.

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://qplwrapper/skin/build.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://qplwrapper/locale/build.dtd">
<!-- qpl_help.xul     K. Dooley --> 

<dialog id="qpl_help"
        persist="screenX screenY width height"
        ondialogcancel="return true;"
    style="width: 50em; min-height: 50em;"

<stringbundleset id="stringbundleset">
    <stringbundle id="qplwrapper-strings" src="chrome://qplwrapper/locale/"/>

<browser id="helpcontent" type="content" src="about:blank" flex="1"/>

<script type="application/x-javascript" src="chrome://qplwrapper/content/qplwrapper.js"/> 
<script type="application/x-javascript" src="chrome://qplwrapper/content/qplwrapper-helper.js"/> 
<script type="application/x-javascript" >
function OpenHelp(HelpFile)
    qplLog("Help: " + HelpFile, true);
    if (HelpFile) {
        if (/^http:/.test(HelpFile)) {
            // qplLog(HelpFile, true);
            document.getElementById('helpcontent').setAttribute('src', HelpFile);
        else {
            var ios = Components.classes[';1'].getService(Components.interfaces["nsIIOService"]);
            var uri = ios.newURI("chrome://qplwrapper/locale/" + HelpFile, "UTF-8", null);
            var cr = Components.classes[';1'].getService(Components.interfaces["nsIChromeRegistry"]);
            Path = cr.convertChromeURL(uri).spec;
            document.getElementById('helpcontent').setAttribute('src', Path);
            qplLog("Help: " + Path, true);