45

I have multiple browser windows usually and it's always not popping up on the one I want.

Can I disable the feature of ionic serve opening in a browser?

4 Answers 4

65

You can pass in the --nobrowser option, or simply -b:

ionic serve --nobrowser 
Sign up to request clarification or add additional context in comments.

Comments

29

Old CLI: As @Claudiu mentioned ionic server -b will not start a browser.

New CLI: the new command is ionic serve --no-open.

If you want to start a browser but not the default one, you can use the -w option.

Eg if Chrome is your default browser, but you want ionic serve to use Firefox instead, you can do something like

ionic serve -w "path/to/firefox.exe" or just ionic serve -w firefox if Firefox is in the path.

More info on ionic serve options:

Comments

9

ionic serve --no-open is the new command. The no-browser has been deprecated

Comments

1

Hello you can pass in the package.json in the :

"scripts": { "clean": "ionic-app-scripts clean", "build": "ionic-app-scripts build", "lint": "ionic-app-scripts lint", "ionic:build": "ionic-app-scripts build", "ionic:serve": "ionic-app-scripts serve" 

}

and pass in the ionic:serve. like this: "ionic:serve": "ionic-app-scripts serve --nobrowser"

and run in the terminal of your project the: npm run ionic:serve

1 Comment

This really not a solution rather a complication, also, even using an updated version such as "ionic:serve": "ionic serve --no-open" and npm run ionic:serve it beahves weirdly and loops the command over and over again.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.