36
\$\begingroup\$

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.

\$\endgroup\$
25
  • 9
    \$\begingroup\$ Are URL shorteners allowed? \$\endgroup\$
    – isaacg
    Mar 30, 2016 at 15:01
  • 4
    \$\begingroup\$ Is it allowed to run JavaScript in the default browser to open a window? \$\endgroup\$
    – Mwr247
    Mar 30, 2016 at 15:30
  • 4
    \$\begingroup\$ @Mwr247 No, it is not. \$\endgroup\$ Mar 30, 2016 at 15:49
  • 15
    \$\begingroup\$ You should add clarifications/restrictions to the question itself, since comments are not guaranteed to stick around forever. \$\endgroup\$
    – user45941
    Mar 30, 2016 at 16:01
  • 8
    \$\begingroup\$ 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 ;) \$\endgroup\$
    – Mwr247
    Mar 30, 2016 at 17:16

49 Answers 49

1
2
2
\$\begingroup\$

Cheddar, 65 bytes

cheddar.internal(cheddar.uid).require("open").c("http://ppcg.ga")

Accesses cheddar internals and then calls upon open package and calls it with string to PPCG. Make sure you have open npm package installed

\$\endgroup\$
1
  • \$\begingroup\$ Shouldn't this be Cheddar+Open if it requires another package? \$\endgroup\$
    – Pavel
    Feb 25, 2017 at 3:54
2
\$\begingroup\$

Red, 40 bytes

browse http://codegolf.stackexchange.com

(Don't) Try it online!

ppcg.ga no longer works, so needed to include the full domain name. But its funny that Red has its own URL data type!

\$\endgroup\$
1
1
\$\begingroup\$

NodeJS, 53 bytes

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

Works on mac.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Duplicate of this \$\endgroup\$
    – user45941
    Mar 30, 2016 at 18:58
  • \$\begingroup\$ 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. \$\endgroup\$
    – MD XF
    Jul 26, 2017 at 3:51
1
\$\begingroup\$

Game Maker Studio, 26 bytes

url_open('http://ppcg.ga')
\$\endgroup\$
4
  • \$\begingroup\$ This is not a complete program. Anyway, have +1 for using GameMaker Studio xDDDDDD \$\endgroup\$ Apr 8, 2016 at 21:18
  • \$\begingroup\$ @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 ;) \$\endgroup\$
    – Timtech
    Apr 8, 2016 at 22:58
  • \$\begingroup\$ 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. \$\endgroup\$ Apr 8, 2016 at 23:00
  • \$\begingroup\$ @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. \$\endgroup\$
    – Timtech
    Apr 8, 2016 at 23:02
1
\$\begingroup\$

PHP (OSX), 33 bytes

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

PHP (Windows), 34 bytes

<?php exec("start http:ppcg.lol");
\$\endgroup\$
2
  • \$\begingroup\$ "'open' is not recognized as an internal or external command, operable program or batch file." \$\endgroup\$ Apr 1, 2016 at 18:06
  • \$\begingroup\$ 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. \$\endgroup\$
    – MD XF
    Jul 26, 2017 at 3:51
1
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$
    – MD XF
    Jul 26, 2017 at 3:51
1
\$\begingroup\$

Perl 6, 45 bytes

Requires the Browser::Open module.

use Browser::Open;open_browser 'http:ppcg.ga'
\$\endgroup\$
2
  • \$\begingroup\$ Do you really need that one whitespace? I can't test this right now. \$\endgroup\$
    – cat
    Apr 29, 2016 at 12:26
  • \$\begingroup\$ Yes, Perl 6 has strict whitespace requirements. \$\endgroup\$
    – Ming-Tang
    Apr 30, 2016 at 3:34
1
\$\begingroup\$

Lua, 30 Bytes

os.execute'start http:ppcg.ga'
\$\endgroup\$
1
\$\begingroup\$

Python, 43 41 40 bytes

import os
os.system("open http:ppcg.ga")
  • -2 bytes thanks to @Quill.
  • -1 byte thanks to @MDXF.
\$\endgroup\$
8
  • \$\begingroup\$ Duplicate of this \$\endgroup\$
    – user45941
    Mar 30, 2016 at 18:57
  • 4
    \$\begingroup\$ @mego how is it a duplicate - It's not even the same language! \$\endgroup\$ Mar 30, 2016 at 22:30
  • \$\begingroup\$ @proudhaskeller See my comments on this answer \$\endgroup\$
    – user45941
    Mar 30, 2016 at 23:56
  • \$\begingroup\$ @mego on the nominations for moderator you said yo believe in hands-off moderation. I don't see how this is reflected here. \$\endgroup\$ Mar 31, 2016 at 6:03
  • \$\begingroup\$ @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. \$\endgroup\$
    – user45941
    Mar 31, 2016 at 6:10
1
\$\begingroup\$

Nim, 47 bytes

import browsers
openDefaultBrowser"www.ppcg.ga"
\$\endgroup\$
2
  • \$\begingroup\$ 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. \$\endgroup\$
    – MD XF
    Jul 26, 2017 at 3:52
  • \$\begingroup\$ ppcg.ml also works \$\endgroup\$
    – Mayube
    Jul 26, 2017 at 8:07
1
\$\begingroup\$

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");
\$\endgroup\$
1
  • \$\begingroup\$ 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. \$\endgroup\$
    – MD XF
    Jul 26, 2017 at 3:51
1
\$\begingroup\$

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.

\$\endgroup\$
4
  • \$\begingroup\$ Needs you the //? \$\endgroup\$ Mar 30, 2016 at 19:31
  • 1
    \$\begingroup\$ @CoolestVeto Yes, otherwise you get an error: * Command Execution Failed: File not found \$\endgroup\$
    – Adám
    Mar 30, 2016 at 19:34
  • \$\begingroup\$ 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. \$\endgroup\$
    – MD XF
    Jul 26, 2017 at 3:52
  • \$\begingroup\$ @PatrickRoberts Thanks. Half an edit. I must have become distracted in the middle. \$\endgroup\$
    – Adám
    Jul 27, 2017 at 21:12
1
\$\begingroup\$

VBA, 84 bytes

Sub Main()
ThisWorkbook.FollowHyperlink("http://codegolf.stackexchange.com")
End Sub
\$\endgroup\$
1
  • \$\begingroup\$ You can get this down to 62 bytes by converting this to an immediate window function as ThisWorkbook.FollowHyperlink"http://codegolf.stackexchange.com, and you should also probably change the language to be Excel VBA, as this explicitly uses the Excel.Workbook object \$\endgroup\$ Jan 7 at 16:36
0
\$\begingroup\$

R, 28 bytes

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

(in utils package)

\$\endgroup\$
1
  • 1
    \$\begingroup\$ 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. \$\endgroup\$
    – MD XF
    Jul 26, 2017 at 3:52
0
\$\begingroup\$

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
\$\endgroup\$
0
\$\begingroup\$

Python, 40 bytes

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

Shorter version of everything else.

\$\endgroup\$
0
\$\begingroup\$

VBScript, 47 bytes

CreateObject("WScript.Shell").Run"http:ppcg.gq"
\$\endgroup\$
0
\$\begingroup\$

C (gcc), 49 38 37 bytes

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

It's for Windows.

\$\endgroup\$
0
\$\begingroup\$

URL, 58 bytes

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

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

\$\endgroup\$
1
  • 1
    \$\begingroup\$ 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? \$\endgroup\$ Sep 21, 2019 at 19:01
1
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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