Python's webbrowser in Go. Simple API for opening web pages on your default browser.

Related tags

Network go webbrowser
Overview

webbrowser Build Status GoDoc Sourcegraph

webbrowser provides a simple API for opening web pages on your default browser.

It's inspired on Python's webbrowser package but lacks some of its features (open new window).

It just opens a webpage, most browsers will open it on a new tab.

Installation

As simple as:

go get -u github.com/toqueteos/webbrowser

It is Go modules compatible!

(go.mod was explicitly added in version v1.2.0)

Usage

package main

import "github.com/toqueteos/webbrowser"

func main() {
    webbrowser.Open("http://golang.org")
}

That's it!

Crossplatform support

The package works on:

  • android (verified by 3rd party)
  • darwin
  • freebsd (verified by 3rd party)
  • linux
  • netbsd (verified by 3rd party)
  • openbsd (verified by 3rd party)
  • windows

License

It is licensed under the MIT open source license, please see the LICENSE.md file for more information.

Thanks...

Miki Tebeka wrote a nicer version that wasn't on godoc.org when I did this, check it out!.

Already disliking it?

No problem! There's alternative libraries that may be better to your needs:

Comments
  • Supposed error while starting Firefox on Windows

    Supposed error while starting Firefox on Windows

    Hi!

    I tried the Windows build of something I'm writing. Firefox is opened with the correct URL, however the library seems to think that it failed. We then tried changing the default browser to IE, but it wouldn't "take" and Firefox kept opening so we couldn't rule out something related to FF. That's also when I gave up on said machine: no dev environment..

    I'm sorry I can't give more information right now, as I don't have access to a Windows machine to debug it on.

    Edit: The actual error is can't open webpage. Here's the code I'm using: https://github.com/nochso/gomd/blob/master/gomd.go#L105 (be gentle, I'm learning ;)

    opened by nochso 13
  • Complex url under Windows problem

    Complex url under Windows problem

    Try start http://httpbin.org/get?a=1&b=2 or start "http://httpbin.org/get?a=1&b=2" Will be opened only http://httpbin.org/get?a=1 or another cmd.

    To fix this you must use: start "%ProgramFiles%\Internet Explorer\iexplore.exe" "http://httpbin.org/get?a=1&b=2" with " around url.

    Best regards

    bug 
    opened by matrixik 5
  • Inconsistent Blocking Behavoirs

    Inconsistent Blocking Behavoirs

    In the python webbrowser, it uses os.startfile, which "returns as soon as the associated application is launched". Unlike the python version, if you are using xdg-open the cmd.Run waits for the process to complete, and for Chrome, xdg-open doesn't return until the Chrome process exits.

    Not sure how you want to approach this, maybe have a func (b browserCommand) Command(s string) (*exec.Command, error), so then the caller can decide if they want to block with .Run() or do something else

    opened by pquerna 3
  •  Add poweron architecture ppc64le to travis build

    Add poweron architecture ppc64le to travis build

    This is part of the Ubuntu distribution for ppc64le. This helps us simplify testing later when distributions are re-building and re-releasing,We typically build applications for customers and ISVs, and while we don't use this package directly, we do count on all of the packages in debian/ubuntu to build other packages. So we more likely have this as a second or third level dependency and couldn't tell you explicitly which features we use or our usage model,For more info tag @gerrith3.

    opened by asellappen 1
  • Add Command method to Browser interface

    Add Command method to Browser interface

    Apparently xdg-open does wait until the browser process is closed to return. This is not ideal, webbrowser.Open should return inmediately.

    See #4 for details.

    You might want to take a look and/or locally test this @pquerna

    opened by toqueteos 1
Releases(v1.0)
Control your legacy Reciva based internet radios (Crane, Grace Digital, Tangent, etc.) via REST api or web browser.

reciva-web-remote Control your legacy Reciva based internet radios (Crane, Grace Digital, Tangent, etc.) via REST api or web browser. Usage This progr

null 6 May 3, 2022
Simple GUI to convert Charles headers to golang's default http client (net/http)

Charles-to-Go Simple GUI to convert Charles headers to golang's default http client (net/http) Usage Compile code to a binary, go build -ldflags -H=wi

null 0 Dec 14, 2021
GoServe - A simple http server capable of serving resources and pages

goServe a simple http server capable of serving resources and pages. disclaimer

Lorenzo 2 Feb 2, 2022
GoServe - A simple http server capable of serving resources and pages

goServe a simple http server capable of serving resources and pages. disclaimer

Lorenzo 2 Feb 2, 2022
Deskreen turns any device with a web browser into a secondary screen for your computer

Deskreen Website: https://deskreen.com ▶️ Deskreen Youtube channel (video tutorials, demos, use cases for Deskreen day to day usage) Deskreen turns an

Paul Pavlo Buidenkov 13.4k Sep 23, 2022
Secure-by-default HTTP servers in Go.

go-safeweb DISCLAIMER: This is not an officially supported Google product. go-safeweb is a collection of libraries for writing secure-by-default HTTP

Google 546 Sep 26, 2022
IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port

IRC bot for launch ddos attack, Mainly of scan target are IoT device that run linux and open default SSH port

R4bin 3 Nov 10, 2021
Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes.

DNS-Updater Simple application in Golang that retrieves your ip and updates your DNS entries automatically each time your IP changes. Motivation Havin

42_atomys 9 Mar 10, 2022
Standalone client for proxies of Windscribe browser extension

windscribe-proxy Standalone Windscribe proxy client. Younger brother of opera-proxy. Just run it and it'll start a plain HTTP proxy server forwarding

null 53 Sep 21, 2022
Fix Burp Suite's horrible TLS stack & spoof any browser fingerprint

Awesome TLS This extension hijacks Burp's HTTP and TLS stack to make it more powerful and less prone to fingerprinting by all kinds of WAFs. It does t

Sleeyax 65 Sep 7, 2022
Send email and SMS broadcasts to your contacts. SMS are sent via your Android phone connected to your PC.

Polysender Send email and SMS broadcasts to your contacts. Polysender is a desktop application, so it does not require a complicated server setup. Ema

Charalampos Mitsakis 13 Aug 11, 2022
🌐 (Web 3.0) Pastebin built on IPFS, securely served by Distributed Web and Edge Network.

pastebin-ipfs 简体中文 (IPFS Archivists) Still in development, Pull Requests are welcomed. Pastebin built on IPFS, securely served by Distributed Web and

Mayo/IO 160 Sep 17, 2022
GOWS is GoLang web-socket module Provides you with ease of handling web socket connections with a few lines

GOWS GOWS is GoLang web-socket module Provides you with ease of handling web socket connections with a few lines, it supports multi-connection on one

null 6 Apr 4, 2022
Go-web-dev - Web Development With Google's Golang Programming Language Code Snippet and Exercises.

Web Development With Google's Golang Programming Language Code Snippet and Exercises This repository contains my code snippets, hands on exercises and

null 2 Jan 16, 2022
Gopi - Simple API for get geo information about your IP Address, Build by go-fiber

gopi Simple API to get information from your IP Address Idea This idea come from IP zxq and literaly i clone it How to download GeoIP2 ? Remember to c

I Made Ocy Darma Putra 3 May 27, 2022
Hetzner-dns-updater - A simple tool to update a DNS record via Hetzner DNS API. Used for simple HA together with Nomad

hetzner-dns-updater A small utility tool to update a single record via Hetzner D

Patrick Pacher 0 Feb 12, 2022
A server that proxies requests and uses fhttp & my fork of CycleTLS to modify your clienthello and prevent your requests from being fingerprinted.

TLS-Fingerprint-API A server that proxies requests and uses my fork of CycleTLS & fhttp (fork of net/http) to prevent your requests from being fingerp

null 160 Sep 19, 2022
A tool helps connect to your AriPods when sound playing in your Mac

Auto connect to airpods this tool helps connect to your AriPods when sound playing in your Mac. dependencenes SwitchAudioSource $ brew install switcha

Fndroid 2 Dec 9, 2021
x-crafter is used to quickly create templates from your prototype, also come with a builder to quickly regenerate your code

XCrafter ?? x-crafter is used to quickly create templates from your prototype, also come with a builder to quickly regenerate your code. Install Using

Chi-Tai Vong 3 Nov 29, 2021