Sublime Forum

Default Browser used by packages in ST3 (how to change)

#1

Packages which open a browser (eg DevDocs or Can I Use) open in Firefox (for me). I have View in Browser default browser set to chrome. Where is the browser being set to Firefox for these Packages? Cant see anywhere in the Package readme where browser is set so I’m assuming its a Sublime setting (but cant find a settings property relating to default to be used).?

Any help appreciated.

0 Likes

#2

its generally the system default browser that gets used - you may be able to override this by setting the BROWSER environment variable, as described here:
https://docs.python.org/3.1/library/webbrowser.html

0 Likes

#3

Thanks for that kingkeith - my system default browser is Chrome (mac osx). For some reason the Sublime Packages like Dev Docs and Can I Use want open in Firefox.

0 Likes

#4

It seems to be a Mac bug

0 Likes

#5

I switched from OpenInBrowser to View in Browser. This package provides key bindings to open in all major browsers. Works great.
LiveReload is also a good one (need to add a Chrome extension as well) that updates browser and/or editor with css changes as you type it.

0 Likes

#6

I’m thinking this al comes down to the SidebarEnhancements package ie the culprit for opening in Firefox but I dont know enough system/javascript to find out how to find/alter the settings to change to chrome. Something to do with url_testing and url_production and F12?? Have tried adding Chrome to user settings in this package as the “default_browser” but still opens in Firefox from right click context menu.

0 Likes

#7

Try build 3133 (see https://github.com/SublimeTextIssues/Core/issues/1714) which you can get using the dev builds (https://www.sublimetext.com/3dev). It fixed a related problem for me.

0 Likes

#8

Thanks - I’m using 3126. Not sure about using dev Builds (for a newbie). Can you roll back to earlier build if issues/problems arise?

0 Likes

#9

If you right click the file name on the left-hand side, under OPEN FILES, you can select ‘Open in Browser’ which opens a submenu to select any of your browsers.

0 Likes

#10

Thanks MIke - on (my) Mac that option/sub-menu pops up but doesn’t do anything. If I right click from the editor then it will open in Firefox. Not sure if its a conflict with View in Browser?

0 Likes

#11

My mistake - You have the option to select a browser from an open folder - not file. So what I mean is when you drag a folder onto Sublime and are able to view all files within, you right click whichever file you’re working on to select a browser:

0 Likes

#12

I get that sub-menu but doesn’t open in any browser (only when I right click from the file in the editor not the sidebar - and then I don’t get any options, it just opens in Firefox).

I notice in the readme for Open in Browser that a configuration file exists but I dont see any in Pref/Package Settings - it just opens an empty sublime-settings file. Should I be adding objects to this file to list the paths of the browsers?

With OpenInBrowser, when you save a file, we scan your configuration settings and look for a match against the current file. If the file you saved matches the pattern you specified, OpenInBrowser will open up the associated url in your default web browser.

Configuration

The configuration file is an array of objects. Each object has a single key, which is the pattern to test the saved file against. The value is the associated url you want to open if the file is matched.

Each object is checked in the order they appear in the array. Once it finds a match, it will execute and open up the associated url.

[

	{"index.html": "http://idevelopsolutions.com"},
	{"index.(html|php)": "http://idevelopsolutions.com"},
	{"index.(html|php)": "http://idevelopsolutions.com/index.$1"}

]
0 Likes

#13

Hi,
Have you try to load the plugin ‘Sidebar Enhancements’.
You’ll find what mikeslug talk about!

0 Likes