Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Your job is to open a browser window of the default browser to http://codegolf.stackexchange.com.

Your code must open the browser itself, and cannot rely on an open one.

This is , so the shortest answer in bytes wins.

share|improve this question
6  
Are URL shorteners allowed? – isaacg Mar 30 at 15:01
3  
Is it allowed to run JavaScript in the default browser to open a window? – Mwr247 Mar 30 at 15:30
4  
@Mwr247 No, it is not. – CrazyPython Mar 30 at 15:49
11  
You should add clarifications/restrictions to the question itself, since comments are not guaranteed to stick around forever. – Mego Mar 30 at 16:01
7  
Your spec is minimal, which led to alot of uncertainty over what is allowed to accomplish the task. Additionally, some probably consider it a trivial task. Still, you're in the positive ;) – Mwr247 Mar 30 at 17:16

39 Answers 39

Python, 46

import webbrowser as w;w.open('http:ppcg.ga');

URL from this comment
Edit: ppcg.ga seems to become more popular now (but it WAS available when I posted this answer).

Ungolfed:

import webbrowser # Imports the webbrowser module
webbrowser.open("http://www.ppcg.ga/") # Opens default browser to http://www.ppcg.ga/

Python, 46

import webbrowser as w;w.open('http:gfa1.tk');

URL from this answer

Ungolfed:

import webbrowser # Imports the webbrowser module
webbrowser.open("http://www.gfa1.tk/") # Opens default browser to http://www.gfa1.tk/

Take that, ppcg.lol! (1 byte shorter)

share|improve this answer

Common Lisp, 31 bytes

(ext:shell "open http:ppcg.ga")

share|improve this answer

R, 28 bytes

browseURL("http://ppcg.lol")

(in utils package)

share|improve this answer

Game Maker Studio, 26 bytes

url_open('http://ppcg.ga')
share|improve this answer

PHP (OSX), 33 bytes

<?php exec("open http:ppcg.lol");

PHP (Windows), 34 bytes

<?php exec("start http:ppcg.lol");
share|improve this answer
    
"'open' is not recognized as an internal or external command, operable program or batch file." – Dewi Morgan Apr 1 at 18:06

C# (Full Class) 90 bytes

class P{static void Main(string[]a){System.Diagnostics.Process.Start("http://ppcg.lol");}}

Not sure that it's possible to write a full class (with the System.Diagnostics reference) any shorter.

Inside main method only without references, 33 bytes:

Process.Start("http://ppcg.lol");
share|improve this answer

Perl 6 (45)

Requires the Browser::Open module.

use Browser::Open;open_browser 'http:ppcg.ga'
share|improve this answer

C++, 61 Bytes

#include <cstdlib>
main(){system("xdg-open http:ppcg.lol");}

Just a rip off of the bash solution using system, and it only works on systems using the freedesktop tools. Also shortened by using the short link some kindly provided, otherwise it would be much longer.

share|improve this answer

Batch, 17 bytes

I used a url shortener so it might take 24 hours to work (blame freedom)

start www.gfa1.tk
share|improve this answer
    
You should include the language for this. Also, this is a trivial improvement upon an existing answer, and thus it should have been a comment rather than a separate answer. – Mego 2 days ago
    
ppgc.ga is working now. – Tim 2 days ago

protected by Mego 2 days ago

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.