http-server icon indicating copy to clipboard operation
http-server copied to clipboard

Open browser with URL

Open jamiewinder opened this issue 10 years ago • 15 comments

The -o option is really handy, but unless I'm missing something I can't ask for anything other than the root to be opened? It'd be handy if we could specific a relative path, e.g.

http-server -o /pages/index.html

Opens browser with http://localhost:8080/pages/index.html

jamiewinder avatar Jan 08 '16 00:01 jamiewinder

This would be handy for me. Looks like pretty isolated changes.

SimplGy avatar Jan 21 '16 18:01 SimplGy

I create a pull request #260 that allows for using both a relative path and still allow for using an absolute path in the same way as before.

I think its a none breaking change as paths starting with a '/' didnt do anything anyway and will still allow anybodies pre-existing scripts to run :) plus its handy to be able to use an absolute url at times as well.

The only stipulation is the relative path must start with a forward slash '/'.

lski avatar Mar 17 '16 16:03 lski

Related to issue #197. PR #250 addresses this directly, and #234, #260 add work arounds. If they could be reviewed, that would be great :)

craigmichaelmartin avatar Mar 31 '16 14:03 craigmichaelmartin

+1

allenhwkim avatar Jul 29 '16 00:07 allenhwkim

I am unbale to open my index.html page using any of following commannd

-o index -o index.html -o 'index.html' -o '/index.html'

Am i misisng on something..I npm installed http-server today itself so believe to have the above change. The browser for me still opens at localhost:8080

soyiatgit avatar Apr 23 '17 17:04 soyiatgit

any updates on this issue?

pmunin avatar Aug 11 '17 21:08 pmunin

Any news on this? Really seems like a useful feature to have!

itsdevdom avatar Oct 10 '17 15:10 itsdevdom

I don't understand what the path part of -o [path] was supposed to do it if did not behave this way. At least one of the four combinations above should be working. I find that (at least on my Linux installation) that it only launches the browser (at all) if I do not specify the path after -o at all.

Any progress on this issue? I'd love to specify a location and a file, or have the root location be implicit in the file, e.g.: http-server site1 -o test1.html or http-server -o site1/test1.html

appurist avatar Dec 15 '17 17:12 appurist

any news on this?=

damianobarbati avatar Nov 21 '18 12:11 damianobarbati

Nothing opens for me at all with the -o flag.

alistair-hmh avatar Feb 27 '19 15:02 alistair-hmh

There were a few PRs open to address this. It looks like https://github.com/indexzero/http-server/pull/250 was @thornjad chosen solution, and is waiting to be merged.

craigmichaelmartin avatar Feb 27 '19 16:02 craigmichaelmartin

#250 should be the one, I have a giant merge train in the works to get things moving.

thornjad avatar Feb 27 '19 16:02 thornjad

I'm having the same problem. The -o option doesn't do anything on Ubuntu 18.04.2 LTS.

slavafomin avatar Jun 25 '19 12:06 slavafomin

This awesome project is lacking a pulse and this was the feature I needed the most.

I wanted to set the public http static folder to ./ then launch to ./example/index.html. But... the problem with -o is that it only launches to the root of the path.

http-server ./ -o

Workaround:

npm install live-server
live-server ./ --open='./example/'

Docs: https://www.npmjs.com/package/live-server

UPDATE:

So this feature was added in https://github.com/http-party/http-server/pull/250 but it's not in the latest release of the package. BUG: https://github.com/http-party/http-server/pull/250#issuecomment-526567304

LarryBattle avatar Nov 02 '19 17:11 LarryBattle

This is working for me in version 0.12.3, please re-open if further problems are found

thornjad avatar Jul 13 '21 15:07 thornjad