Open the browser to http://codegolf.stackexchange.com

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.

• Are URL shorteners allowed? – isaacg Mar 30 '16 at 15:01
• Is it allowed to run JavaScript in the default browser to open a window? – Mwr247 Mar 30 '16 at 15:30
• @Mwr247 No, it is not. – noɥʇʎԀʎzɐɹƆ Mar 30 '16 at 15:49
• You should add clarifications/restrictions to the question itself, since comments are not guaranteed to stick around forever. – Mego Mar 30 '16 at 16:01
• 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 '16 at 17:16

NodeJS, 53 bytes

require('child_process').exec('open http://ppcg.lol')


Works on mac.

• Duplicate of this – Mego Mar 30 '16 at 18:58
• ppcg.lol has been unregistered, invalidating this answer :I However, I just registered ppcg.ga, so you can use that instead, saving a byte anyway. – MD XF Jul 26 '17 at 3:51

Game Maker Studio, 26 bytes

url_open('http://ppcg.ga')

• This is not a complete program. Anyway, have +1 for using GameMaker Studio xDDDDDD – Luis Masuelli Apr 8 '16 at 21:18
• @LuisMasuelli Yes it is. No need to use a script or anything - there is a way to run "creation code" in the room settings, which is usually how you would run any GML code for this site. But thanks ;) – Timtech Apr 8 '16 at 22:58
• U're right. There's actually no way of posting a complete program since most of the execution is not done by explicit code but GMS internal lifecycle. – Luis Masuelli Apr 8 '16 at 23:00
• @LuisMasuelli Yes, that's why I usually only use the GML code script in the objects and room creation code, none of the drag-and-drop anymore. – Timtech Apr 8 '16 at 23:02

PHP (OSX), 33 bytes

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


PHP (Windows), 34 bytes

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

• "'open' is not recognized as an internal or external command, operable program or batch file." – Dewi Morgan Apr 1 '16 at 18:06
• ppcg.lol has been unregistered, invalidating this answer :I However, I just registered ppcg.ga, so you can use that instead, saving a byte anyway. – MD XF Jul 26 '17 at 3:51

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.

• ppcg.lol has been unregistered, invalidating this answer :I However, I just registered ppcg.ga, so you can use that instead, saving a byte anyway. – MD XF Jul 26 '17 at 3:51

Windows Batch, 17 bytes

start www.gfa1.tk

• 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 Apr 2 '16 at 2:14
• ppgc.ga is working now. – Tim Apr 2 '16 at 20:35
• gfa1.tk has been unregistered, invalidating this answer :I However, I just registered ppcg.ga, so you can use that instead, saving a byte anyway. – MD XF Jul 26 '17 at 3:52

Perl 6, 45 bytes

Requires the Browser::Open module.

use Browser::Open;open_browser 'http:ppcg.ga'

• Do you really need that one whitespace? I can't test this right now. – cat Apr 29 '16 at 12:26
• Yes, Perl 6 has strict whitespace requirements. – Ming-Tang Apr 30 '16 at 3:34

Lua, 30 Bytes

os.execute'start http:ppcg.ga'


Python, 4341 40 bytes

import os
os.system("open http:ppcg.ga")

• -2 bytes thanks to @Quill.
• -1 byte thanks to @MDXF.
• Duplicate of this – Mego Mar 30 '16 at 18:57
• @mego how is it a duplicate - It's not even the same language! – proud haskeller Mar 30 '16 at 22:30
• @mego on the nominations for moderator you said yo believe in hands-off moderation. I don't see how this is reflected here. – proud haskeller Mar 31 '16 at 6:03
• @proudhaskeller By hands-off moderation, I mean letting the community do all the moderation work that it can, rather than stepping in with mod powers. As I am neither a moderator nor using moderation powers/privileges, this is still hands-off moderation. If you wish to discuss my views on moderation further, I would encourage you to do so with me in the chatroom created specifically for that purpose. – Mego Mar 31 '16 at 6:10

C# (Full Class) 89 bytes

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


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

Inside main method only without references, 32 bytes:

Process.Start("http://ppcg.ga");

• ppcg.lol has been unregistered, invalidating this answer :I However, I just registered ppcg.ga, so you can use that instead, saving a byte anyway. – MD XF Jul 26 '17 at 3:51

Dyalog APL, 20 19 bytes

-1 byte thanks to MD XF

]Open http://ppcg.ga


Uses the User Command ]Open, which is installed with Dyalog.

• Needs you the //? – Addison Crump Mar 30 '16 at 19:31
• @CoolestVeto Yes, otherwise you get an error: * Command Execution Failed: File not found – Adám Mar 30 '16 at 19:34
• ppcg.lol has been unregistered, invalidating this answer :I However, I just registered ppcg.ga, so you can use that instead, saving a byte anyway. – MD XF Jul 26 '17 at 3:52
• @PatrickRoberts Thanks. Half an edit. I must have become distracted in the middle. – Adám Jul 27 '17 at 21:12

R, 28 bytes

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


(in utils package)

• ppcg.lol has been unregistered, invalidating this answer :I However, I just registered ppcg.ga, so you can use that instead, saving a byte anyway. – MD XF Jul 26 '17 at 3:52

SX, 38 bytes (might be non-competing)

的 webbrowser im**;o&('http:ppcg.ga')


Save this shell script as SXexec.sh to your SX directory:

#!/bin/sh
N=$1.py;python Main.py$1;wine SXCompiler.exe $N;rm$N;python $N.py;rm$N.py


The script features tidying up after execution. To execute the above script, you need to have Wine and Python. Usage is like this:

SXexec.sh file


Nim, 47 bytes

import browsers
openDefaultBrowser"www.ppcg.ga"

• ppcg.lol has been unregistered, invalidating this answer :I However, I just registered ppcg.ga, so you can use that instead, saving a byte anyway. – MD XF Jul 26 '17 at 3:52
• ppcg.ml also works – Skidsdev Jul 26 '17 at 8:07

Python, 40 bytes

__import__('webbrowser').open('ppcg.ga')


Shorter version of everything else.

VBScript, 47 bytes

CreateObject("WScript.Shell").Run"http:ppcg.gq"


C (gcc), 4938 37 bytes

main(){system("start http:ppcg.ga");}


It's for Windows.

URL, 58 bytes

[InternetShortcut]
URL=https://codegolf.stackexchange.com


In Windows create a file "url.URL", with a code editor put the code.

• Welcome to the site! As it isn't clear whether this works or not, could you provide either instructions for running this, or a link to an online testing environment such as TryItOnline!, so that others can verify your answer? – caird coinheringaahing Sep 21 at 19:01