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.


Moderator note: A large number of answers to this challenge use the URLs http://ppcg.lol or http://ppcg.ga. These URLs did direct to https://codegolf.stackexchange.com at the time, but have since expired. By this meta discussion, they have been allowed to stay, with the note that they are currently invalid.

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

50 Answers 50

47
\$\begingroup\$

Oration, 41 bytes

Not winning, but sure was fun. As of right now, I'm only 1 bytee behind python!

I need webbrowser
Now open "http:ppcg.ga"

Explanation:

I need compiles to import $1 with webbrowser being the module.

Now runs the following command from the module as module.command with the arguments of anything following.

So this compiles to:

#!/usr/bin/env python3
import webbrowser
webbrowser.open("http:ppcg.ga")

I do end up needing the http: part though, and it can't be shortened.

\$\endgroup\$
8
  • \$\begingroup\$ This conversation has been moved to chat. \$\endgroup\$
    – Dennis
    Commented Mar 30, 2016 at 17:40
  • \$\begingroup\$ I'm almost certain that you can replace "http://ppcg.lol" with "http:ppcg.lol". I'm uncertain whether you can remove the space between open and "http:...", but try it? \$\endgroup\$ Commented Mar 30, 2016 at 19:01
  • 3
    \$\begingroup\$ @Quill I meant how do we know you won't Rick roll us all at some future point? \$\endgroup\$ Commented Mar 30, 2016 at 23:55
  • 1
    \$\begingroup\$ @Quill that depends on how much you like Rick... \$\endgroup\$
    – TMH
    Commented Apr 1, 2016 at 15:35
  • 2
    \$\begingroup\$ Please note that the URL ppcg.ga no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:46
42
\$\begingroup\$

Batch, 17 bytes

Saved 3 bytes thanks to Mego.

start www.ppcg.ga

This will open in your default browser if you run it from the windows command line.

I think it'll work in Powershell too, but I'm not sure.

\$\endgroup\$
12
  • 3
    \$\begingroup\$ You can use start instead of explorer. \$\endgroup\$
    – user45941
    Commented Mar 30, 2016 at 15:07
  • 8
    \$\begingroup\$ You can use start www.ppcg.lol instead to implicitly have Windows parse it as HTTP. Works in both CMD and PowerShell. \$\endgroup\$ Commented Mar 30, 2016 at 15:37
  • 2
    \$\begingroup\$ Why do you need the www.? \$\endgroup\$
    – Blender
    Commented Mar 30, 2016 at 20:26
  • 3
    \$\begingroup\$ @Blender Because otherwise it tries to find a local program called pccg with the .lol file extension and run it. \$\endgroup\$ Commented Mar 30, 2016 at 20:27
  • 2
    \$\begingroup\$ @PyRulez It's not a URL shortener, technically. Quill bought that domain a while back and set up a DNS redirect. \$\endgroup\$
    – user45941
    Commented Mar 31, 2016 at 6:21
38
\$\begingroup\$

 GNU Emacs, 29 27 14 33 bytes

(eww"codegolf.stackexchange.com")

The previous answer with a URL shortener was:

(eww"ppcg.ga") ;; 14 bytes

However:

Much like ppcg.lol, ppcg.ga has been unregistered, invalidating this answer. But unlike last time, there is no replacement short url. (@lyxal)

EWW is a browser inside Emacs. The browse-web function is an alias for eww, and so that makes eww the default browser in Emacs:

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

Thanks to @CoolestVeto, @Jonathan Leech-Pepin and @zyabin101.

\$\endgroup\$
9
  • \$\begingroup\$ Can you use www.ppcg.lol instead of http://ppcg.lol? \$\endgroup\$ Commented Mar 30, 2016 at 15:55
  • 1
    \$\begingroup\$ @TimmyD No, at first I tried with "www" but the protocol must be supplied (the behavior is different for example with "mailto://"). For user interaction, there is "browse-url-at-point" which prepends "http", but this is longer of course. \$\endgroup\$
    – coredump
    Commented Mar 30, 2016 at 16:47
  • \$\begingroup\$ You shouldn't need the //, I don't think. (I don't use emacs, but it's generally accepted without the //) \$\endgroup\$ Commented Mar 30, 2016 at 19:03
  • 13
    \$\begingroup\$ ಠ_ಠ PPCG is not something to "ewwww" that, that's code review :P \$\endgroup\$
    – Downgoat
    Commented Apr 12, 2016 at 2:01
  • 3
    \$\begingroup\$ Apparently there is ppcg.ga. It may save you a byte. \$\endgroup\$
    – user48538
    Commented Apr 29, 2016 at 16:15
26
\$\begingroup\$

PowerShell, 17 16 Bytes

saps www.ppcg.lol 

Using an even shorter domain provided by Milo.

saps www.ppcg.ga

While start is a known alias for Start-Process there is another one for saps. You can see this from Get-Alias. It follows the convention for similar Start- and Stop- cmdlets.


As those URLs no longer exist the only way to make this work is to use the horribly inefficient 36 characters for

saps http:codegolf.stackexchange.com

At least we can drop the slashes no problem

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

Terminal (OSX), 20 18 17 bytes

open http:ppcg.ga

Saved 2 thanks to CoolestVeto

\$\endgroup\$
6
  • 6
    \$\begingroup\$ open is an OSX utility, not a bash one; this would be more appropriately called "OSX command line". \$\endgroup\$
    – Skyler
    Commented Mar 30, 2016 at 15:17
  • 1
    \$\begingroup\$ @Skyler Is this incorrect then? ss64.com/bash/open.html \$\endgroup\$
    – Mwr247
    Commented Mar 30, 2016 at 15:19
  • 1
    \$\begingroup\$ the first line: "Open a file in its default application, using virtual terminal (VT)." If you try to run that on unix, it will tell you "Couldn't get a file descriptor referring to the console", because it's trying to open in a terminal, not in a browser. \$\endgroup\$
    – Skyler
    Commented Mar 30, 2016 at 15:21
  • 3
    \$\begingroup\$ You can get rid of //. \$\endgroup\$ Commented Mar 30, 2016 at 18:50
  • 2
    \$\begingroup\$ You can save another byte: open http:ppcg.ga \$\endgroup\$
    – DarkDust
    Commented Apr 2, 2016 at 13:52
14
\$\begingroup\$

MATLAB, 28 25 bytes

web www.ppcg.lol -browser
  • www is shorter than http:// and ensures that the address is processed as a URL
  • This is shorter using the implicit function call (which casts inputs as strings) rather than the explicit version web('www.ppcg.lol', '-browser').
  • If you are on a OS X, this can be simplified to web ppcg.lol -browser as MATLAB will automatically append an http:// (21 bytes)

Alternatives:

  • On windows this can be shortened to (19 bytes)

    !start www.ppcg.lol
    
  • On OS X (21 bytes)

    !open http://ppcg.lol
    
  • The following would work in a deployed MATLAB application (16 bytes)

    web www.ppcg.lol
    
  • If the built-in browser could be used this could be reduced even further as http is implied (12 bytes)

    web ppcg.lol
    
\$\endgroup\$
7
  • \$\begingroup\$ OS X is redundant because the built-in open command does the same. \$\endgroup\$ Commented Mar 30, 2016 at 15:50
  • 1
    \$\begingroup\$ @CrazyPython That's precisely what ! does in MATLAB, it's the equivalent of system(command). I had it as more of a demonstration of other alternatives that could be executed from within MATLAB. Is that OK? \$\endgroup\$
    – Suever
    Commented Mar 30, 2016 at 15:53
  • \$\begingroup\$ Do you need the www.? \$\endgroup\$ Commented Mar 30, 2016 at 19:02
  • \$\begingroup\$ @CoolestVeto Sometimes you do sometimes you do not. When using the external browser you do, however the internal browser you do not. If you do not specify it, no browser window will open. If you can get it to work, I'm more than happy to change it! \$\endgroup\$
    – Suever
    Commented Mar 30, 2016 at 19:07
  • 1
    \$\begingroup\$ Please note that the URL ppcg.lol no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:49
13
\$\begingroup\$

AutoHotKey, 16 bytes

Run www.ppcg.lol
\$\endgroup\$
16
  • 7
    \$\begingroup\$ Unfortunately, not everybody has *shudder* Google Chrome *shudder* set as their default browser (or installed at all!). \$\endgroup\$
    – wizzwizz4
    Commented Mar 30, 2016 at 18:23
  • 5
    \$\begingroup\$ Not everyone has AHK either...both facts are very shudder worthy \$\endgroup\$ Commented Mar 30, 2016 at 18:23
  • 5
    \$\begingroup\$ I was shuddering because I had to type... never mind. \$\endgroup\$
    – wizzwizz4
    Commented Mar 30, 2016 at 18:26
  • 2
    \$\begingroup\$ The challenge spec requires opening PPCG in the default browser, which may or may not be Chrome. \$\endgroup\$
    – Dennis
    Commented Mar 30, 2016 at 18:40
  • 1
    \$\begingroup\$ You don't need the comma \$\endgroup\$ Commented Mar 30, 2016 at 19:31
13
\$\begingroup\$

Python, 52 48 47 45 44 bytes

Shamelessly borrowing that shortened link.

from webbrowser import*;open("http:ppcg.ga")

Thanks to CrazyPython for -4 bytes, and Sp3000 for a further one.

Edit: shaved 2 more off thanks to CoolestVeto

Edit: thanks to MD XF for registering ppcg.ga and saving another byte

\$\endgroup\$
5
  • \$\begingroup\$ The former change leaves it exactly the same length. As for the http://, if you leave that out it tries to open a local file called "ppcg.lol", which doesn't exist. \$\endgroup\$
    – Skyler
    Commented Mar 30, 2016 at 15:27
  • 1
    \$\begingroup\$ You don't need //. \$\endgroup\$ Commented Mar 30, 2016 at 19:06
  • \$\begingroup\$ Thanks! I wonder why that works? \$\endgroup\$
    – Skyler
    Commented Mar 30, 2016 at 19:10
  • 1
    \$\begingroup\$ You can also do this with just command line options python -m webbrowser -t http:ppcg.lol which I think counts as 30 chars \$\endgroup\$
    – gnibbler
    Commented Mar 31, 2016 at 6:24
  • 1
    \$\begingroup\$ Please note that the URL ppcg.ga no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:49
10
\$\begingroup\$

Java 7, 151 bytes

class P{public static void main(String[]a)throws Exception{java.awt.Desktop.getDesktop().browse(new java.net.URI("http:codegolf.stackexchange.com"));}}

Java is not the best language for golfing... Here's the same program in a more readable format:

class P {
    public static void main (String[] a) throws Exception {
        java.awt.Desktop.getDesktop().browse(new java.net.URI("http:codegolf.stackexchange.com"));
    }
}

Saved 2 bytes by removing // in the URI/L, and another byte by switching to .ga from .lol (indirectly thanks to @Milo)

\$\endgroup\$
4
  • 9
    \$\begingroup\$ Use interface for shorter code \$\endgroup\$
    – user45941
    Commented Mar 30, 2016 at 16:34
  • 1
    \$\begingroup\$ @Mego I could do that, but then it would be Java 8. This is a Java 7 answer. But thanks for the tip! \$\endgroup\$
    – hyper-neutrino
    Commented Mar 30, 2016 at 17:11
  • 8
    \$\begingroup\$ code-golf specifies that functions are sufficient, you do not have to write a full program. So void f(){ .... } would be enough. \$\endgroup\$
    – flawr
    Commented Mar 30, 2016 at 19:52
  • \$\begingroup\$ Can static blocks throw exceptions? If yes, use one. \$\endgroup\$
    – univalence
    Commented Sep 24, 2016 at 19:01
9
\$\begingroup\$

Bash, 24 22 bytes

xdg-open http:ppcg.lol

Not as short as some others. firefox ppcg.lol is shorter, but it doesn't meet question spec.

\$\endgroup\$
9
  • \$\begingroup\$ xdg-open www.ppcg.lol works for me as well. \$\endgroup\$ Commented Mar 30, 2016 at 17:47
  • \$\begingroup\$ @digital_trauma interesting, it didn't for me. It looked for www.ppcg.lol on the file system. Ubuntu 15.10. \$\endgroup\$
    – Ogaday
    Commented Mar 30, 2016 at 18:29
  • 1
    \$\begingroup\$ You shouldn't need the //. \$\endgroup\$ Commented Mar 30, 2016 at 19:03
  • 1
    \$\begingroup\$ @CoolestVeto Correct. xdg-open http:ppcg.lol also works for me. \$\endgroup\$ Commented Mar 30, 2016 at 20:18
  • 1
    \$\begingroup\$ Please note that the URL ppcg.lol no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:49
8
\$\begingroup\$

Java 8, 115 112 bytes

interface P{static void main(String[]a)throws Exception{java.awt.Desktop.getDesktop().browse(new java.net.URI("http:ppcg.ga"));}}

Java is not the best language for golfing... Here's the same program in a more readable format:

interface P {
    static void main (String[] a) throws Exception {
        java.awt.Desktop.getDesktop().browse(new java.net.URI("http:ppcg.ga"));
    }
}

Saved 2 bytes by removing // (thanks @CoolestVeto), and another byte by switching to .ga from .lol (indirect thanks to @Milo)

\$\endgroup\$
6
  • \$\begingroup\$ You can remove the //. \$\endgroup\$ Commented Mar 30, 2016 at 19:04
  • \$\begingroup\$ Isn't it supposed to be java.net? \$\endgroup\$ Commented Mar 31, 2016 at 14:04
  • \$\begingroup\$ cant you replace interface with class? \$\endgroup\$
    – MCMastery
    Commented Mar 31, 2016 at 15:24
  • \$\begingroup\$ @MCMastery Yes. However, with an interface, you can save 3 bytes because even though interface is longer than class, you save more bytes because the public modifier is implied. \$\endgroup\$
    – hyper-neutrino
    Commented Mar 31, 2016 at 19:32
  • 1
    \$\begingroup\$ Please note that the URL ppcg.ga no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:50
8
\$\begingroup\$

Pylongolf, 11 bytes

"ppcg.lol"p

Pushes ppcg.lol into the stack then p opens it.

\$\endgroup\$
5
  • \$\begingroup\$ Will that open it as a local file, or as a website address? \$\endgroup\$
    – wizzwizz4
    Commented Mar 30, 2016 at 18:09
  • \$\begingroup\$ And did you just add the changes that allowed this to work? \$\endgroup\$
    – Riker
    Commented Mar 30, 2016 at 18:09
  • \$\begingroup\$ @wizzwizz4 As an address. Yes, so this does not compete with others, just for fun. \$\endgroup\$
    – user47018
    Commented Mar 30, 2016 at 18:23
  • \$\begingroup\$ Lemme guess, freenom? \$\endgroup\$
    – user47018
    Commented Jul 26, 2017 at 11:32
  • 2
    \$\begingroup\$ Please note that the URL ppcg.lol no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:51
7
\$\begingroup\$

JavaScript, 34 bytes

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

Uses Node.js

\$\endgroup\$
5
  • \$\begingroup\$ Do you need //? \$\endgroup\$ Commented Mar 30, 2016 at 19:04
  • 2
    \$\begingroup\$ If node.js supports ES6: require`open``http://ppcg.lol`; (added ; to avoid tripping the formatting) \$\endgroup\$ Commented Mar 31, 2016 at 8:17
  • 2
    \$\begingroup\$ Alternatively, does it require a protocol? eg require('open')('//ppcg.lol') to save 5 bytes \$\endgroup\$
    – Martijn
    Commented Mar 31, 2016 at 11:56
  • 2
    \$\begingroup\$ @Martijn Shh... \$\endgroup\$
    – wizzwizz4
    Commented Mar 31, 2016 at 15:36
  • 1
    \$\begingroup\$ Please note that the URL ppcg.lol no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:51
5
\$\begingroup\$

Applescript, 28 bytes

  • 3 bytes saved thanks to @CoolestVeto.
open location"http:ppcg.lol"
\$\endgroup\$
5
  • 1
    \$\begingroup\$ how dare a high-rep user not format their header correctly D: \$\endgroup\$
    – cat
    Commented Apr 11, 2016 at 0:08
  • 1
    \$\begingroup\$ @cat actually, I've never been called out on this before - I've always operated on the assumption that bytes is the default for codegolf (and is even explicitly specified in this question), so explicitly respecifying in answers is just redundant information. Do you know of a meta post about this? \$\endgroup\$ Commented Apr 14, 2016 at 5:32
  • \$\begingroup\$ Well, first and foremost, my comment was messing around -- I only changed it for consistency with all the other answers, and it's really insignificant but it bothered me. I'm pretty sure there's no meta post on formatting specifically, and that this format came from the Leaderboard Stack Snippets, but I'm almost certain there's a meta post for Defaults for Scoring Code Golf that says it's bytes unless otherwise specified. \$\endgroup\$
    – cat
    Commented Apr 14, 2016 at 10:15
  • 1
    \$\begingroup\$ @cat Yep, I don't think its a big deal either way - I'm certainly not planning on rolling back your edit :). Scoring by bytes by default is in the code-golf tag wiki \$\endgroup\$ Commented Apr 14, 2016 at 10:32
  • 1
    \$\begingroup\$ Please note that the URL ppcg.lol no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:51
5
\$\begingroup\$

Mathematica, 28 bytes

SystemOpen@"http://ppcg.lol"
\$\endgroup\$
4
  • \$\begingroup\$ That would be 16 bytes in Mthmtca. \$\endgroup\$ Commented Mar 30, 2016 at 18:40
  • \$\begingroup\$ Do you need //? \$\endgroup\$ Commented Mar 30, 2016 at 19:04
  • \$\begingroup\$ @CoolestVeto I think I do. \$\endgroup\$ Commented Mar 30, 2016 at 19:05
  • 1
    \$\begingroup\$ Please note that the URL ppcg.lol no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:51
4
\$\begingroup\$

R, 26 bytes

shell.exec("www.ppcg.lol")

I don't know of any shorter way to do this in R.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Duplicate of this. Simply wrapping another answer in a system/fork/whatever call is a trivial modification. \$\endgroup\$
    – user45941
    Commented Mar 30, 2016 at 19:40
  • 1
    \$\begingroup\$ Please note that the URL ppcg.lol no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:52
4
\$\begingroup\$

Actionscript 3, 117 bytes

package{import flash.display.Sprite;public class A extends Sprite{function A(){navigateToUrl("ppcg.lol","_blank")}}}

Like Java, this is not a great golfing language. Here's the code with formatting:

package
{
    import flash.display.Sprite;
    
    public class A extends Sprite
    {
        function A()
        {
            navigateToUrl("ppcg.lol", "_blank")
        }
    }
}
\$\endgroup\$
1
4
\$\begingroup\$

Rebol 2, 16 15 bytes

browse"ppcg.ga" 

if you accept an error before opening the page on Linux, no error on Windows

20 bytes without an error

browse http:ppcg.lol
\$\endgroup\$
3
  • \$\begingroup\$ Alternative to the first one (although with the same score): browse #ppcg.lol \$\endgroup\$
    – Izkata
    Commented Apr 1, 2016 at 20:02
  • \$\begingroup\$ now with shorter url.( \$\endgroup\$
    – sqlab
    Commented Apr 13, 2016 at 11:53
  • 1
    \$\begingroup\$ Please note that the URL ppcg.ga no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:52
4
\$\begingroup\$

Perl 5, 66 57 76 bytes

Should work everywhere, but needs that import :(

8 bytes saved with @msh210 comment.

use Browser::Open open_browser;open_browser"http:codegolf.stackexchange.com"

Also, for funsies :

Perl 5 (Windows), 34 48 bytes

system "start http://codegolf.stackexchange.com"

Perl 5 (Unix), 31 49 bytes

system "xdg-open http:codegolf.stackexchange.com"
\$\endgroup\$
2
  • \$\begingroup\$ use -M instead of use to shave a coupla bytes. (Untested.) Also, I'm guessing you don't need the parens or the www.. (Also untested.) \$\endgroup\$
    – msh210
    Commented Apr 1, 2016 at 21:40
  • \$\begingroup\$ @msh210 Can't seem to get the -M switch to work apparently on my Mac... (?), but indeed the www as well as the // can be removed. Thanks ! \$\endgroup\$
    – Sake
    Commented Apr 3, 2016 at 8:46
3
\$\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
3
\$\begingroup\$

Factor, 38 36 26 29 bytes

[ "http:t.ly/-E-J" open-url ]

I didn't know one could golf-off the // in the protocol.

\$\endgroup\$
11
  • \$\begingroup\$ I think you can remove the space between the end-quote and run-process, and you can wholly drop //. \$\endgroup\$ Commented Mar 30, 2016 at 19:16
  • \$\begingroup\$ @CoolestVeto Thanks! I didn't know the // could be left off. As for the space between " and run-process, dropping that would require a word named "run-process to be present in the current vocabulary search path \$\endgroup\$
    – cat
    Commented Mar 30, 2016 at 19:22
  • \$\begingroup\$ @CoolestVeto Factor's like Forth -- highly whitespace dependent \$\endgroup\$
    – cat
    Commented Mar 30, 2016 at 19:24
  • \$\begingroup\$ Duplicate of this. Simply wrapping another answer in a system/fork/whatever call is a trivial modification. \$\endgroup\$
    – user45941
    Commented Mar 30, 2016 at 19:35
  • \$\begingroup\$ @Mego Okay, well, not that it really matters but I did come up with this without seeing that one. But, there is really no other way to run The default browser without xdg-open in languages which are not equipped with special functions for browsing the web. A C or ASM answer would surely also have to do system("xdg-open...") \$\endgroup\$
    – cat
    Commented Mar 30, 2016 at 19:44
2
\$\begingroup\$

RFO-BASIC, 22 bytes

BROWSE "http:ppcg.lol"

Read about RFO-BASIC at laughton.com.

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

VBScript, 57 bytes

I used to have lots of fun creating tiny programs in VBScript, back in 2010.

I've remembered this language and used the code on: https://stackoverflow.com/a/13401872/2729937

It still works on Windows 7, at least.

set S=CreateObject("WScript.Shell")
S.run("www.ppcg.ga")

This is a bit different from the usual start www.ppcg.lol, in the sense that it executes the www.ppcg.ga directly, with an implicit start.

An alternative way would be "cmd.exe /C start www.ppcg.ga".

\$\endgroup\$
1
2
\$\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\$ Commented Jan 7, 2022 at 16:36
2
\$\begingroup\$

Zsh on MacOS, 19 bytes

open http:t.ly/-E-J

Try it online!   (t.ly is a URL shortener).

\$\endgroup\$
2
\$\begingroup\$

Common Lisp, 31 bytes

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

Note: This worked at the time of writing. The domain ppcg.ga has since expired, making this answer no longer valid.

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

C#, 33 bytes

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

Opens the default browser to the web address

\$\endgroup\$
5
  • \$\begingroup\$ Nope... Replace \\ via //. \$\endgroup\$
    – Qwertiy
    Commented Mar 31, 2016 at 1:16
  • \$\begingroup\$ not a c# program, just a single line \$\endgroup\$
    – BryanJ
    Commented Apr 1, 2016 at 13:31
  • \$\begingroup\$ Also this needs the System.Diagnostics namespace to be added in or Process to be fully qualified to work. \$\endgroup\$ Commented Apr 1, 2016 at 15:25
  • 1
    \$\begingroup\$ This is not a c# program. \$\endgroup\$ Commented Apr 3, 2016 at 14:36
  • 1
    \$\begingroup\$ Please note that the URL ppcg.lol no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:53
1
\$\begingroup\$

VB.NET, 32 30 bytes

Process.Start("http:ppcg.lol")
\$\endgroup\$
2
  • \$\begingroup\$ +10 for Sub Main(), and +7 for End Sub, which you need in order to run this at least in a VB.NET console program, also you would need to import System.Diagnostics. \$\endgroup\$
    – James Hyde
    Commented Apr 12, 2016 at 12:26
  • 1
    \$\begingroup\$ Please note that the URL ppcg.lol no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:53
1
\$\begingroup\$

Game Maker Studio, 26 bytes

url_open('http://ppcg.ga')
\$\endgroup\$
5
  • \$\begingroup\$ This is not a complete program. Anyway, have +1 for using GameMaker Studio xDDDDDD \$\endgroup\$ Commented 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
    Commented 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\$ Commented 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
    Commented Apr 8, 2016 at 23:02
  • \$\begingroup\$ Please note that the URL ppcg.ga no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:56
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\$ Commented Apr 1, 2016 at 18:06
  • \$\begingroup\$ Please note that the URL ppcg.lol no longer works, and it is recommended you update your answer to a URL that does work, ideally codegolf.stackexchange.com. For more information, see the note in the challenge, or this meta discussion \$\endgroup\$ Commented Jan 7, 2023 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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