You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.9 KiB

  1. # webbrowser [![Build Status](https://travis-ci.org/toqueteos/webbrowser.png?branch=master)](https://travis-ci.org/toqueteos/webbrowser) [![GoDoc](http://godoc.org/github.com/toqueteos/webbrowser?status.png)](http://godoc.org/github.com/toqueteos/webbrowser) [![Sourcegraph](https://sourcegraph.com/github.com/toqueteos/webbrowser/-/badge.svg)](https://sourcegraph.com/github.com/toqueteos/webbrowser?badge)
  2. webbrowser provides a simple API for opening web pages on your default browser.
  3. It's inspired on [Python's webbrowser](http://docs.python.org/3/library/webbrowser.html) package but lacks some of its features (open new window).
  4. It just opens a webpage, most browsers will open it on a new tab.
  5. ## Installation
  6. As simple as:
  7. ```bash
  8. go get -u github.com/toqueteos/webbrowser
  9. ```
  10. ## Usage
  11. ```go
  12. package main
  13. import "github.com/toqueteos/webbrowser"
  14. func main() {
  15. webbrowser.Open("http://golang.org")
  16. }
  17. ```
  18. That's it!
  19. ## Crossplatform support
  20. The package works on:
  21. - [x] `android` (verified by 3rd party)
  22. - [x] `darwin`
  23. - [x] `freebsd` (verified by 3rd party)
  24. - [x] `linux`
  25. - [x] `netbsd` (verified by 3rd party)
  26. - [x] `openbsd` (verified by 3rd party)
  27. - [x] `windows`
  28. ## License
  29. It is licensed under the MIT open source license, please see the [LICENSE.md](https://github.com/toqueteos/webbrowser/blob/master/LICENSE.md) file for more information.
  30. ## Thanks...
  31. Miki Tebeka wrote a nicer version that wasn't on godoc.org when I did this, [check it out!](https://bitbucket.org/tebeka/go-wise/src/d8db9bf5c4d1/desktop.go?at=default).
  32. ## Already disliking it?
  33. No problem! There's alternative libraries that may be better to your needs:
  34. - https://github.com/pkg/browser, it does what webbrowser does and more!
  35. - https://github.com/skratchdot/open-golang, it even provides a `xdg-open` implementation in case you don't have it!