Setting for previewing all HTML files in a specific browser

Dear All,

I am trying to set-up Komodo in such a way that Browser Preview will always make files open externally in Firefox. You can save the settings for an individual file and I set Firefox as the browser to preview under Web & Browser in settings but I still get the dialog box every time I try to preview a file. Is there a way around it?

Regards,
George

You can select “Remember this selection for this file” when doing a preview, but that is only for the current file. There is currently no global way of always opening a file automatically with a given browser because there are 2 variables to previewing:

  • The browser to use - this ones easy, and you can select a default in your Preferences for this (Prefs > Web & Browsers.
  • The preview path - this is pretty hard for us to predict as we do not how you are serving up your file

That said, you could easily create a custom macro that suits your own use-case. For example:

var view = ko.views.manager.currentView;
view.koDoc.prefs.setStringPref("preview_path", view.koDoc.file.displayPath);
view.koDoc.prefs.setStringPref("preview_browser", "firefox");
ko.commands.doCommand('cmd_browserPreview')

This will preview the current file using it’s path on the filesystem and Firefox as the browser. Note that this essentially saves your browser preview settings for this file as it would when you set “Remember this selection for this file”.

You can add this as a macro in your toolbox (in the right sidebar by default) and set a keybind on it. If you prefer to access it as a toolbar button you could add a “Custom Toolbar” in your Toolbox and place your macro under it, then right click your toolbar and enable the custom toolbar you added.

There are a ton of other ways to invoke macro’s, but that should be enough to get you started.

1 Like

Another alternative - you could also create a Komodo macro that called the external browser preview method too:

// Open the external browser with the current file URI.
ko.browse.openUrlInDefaultBrowser(ko.views.manager.currentView.koDoc.file.URI);