Your job is to open a browser window of the default browser to http://codegolf.stackexchange.com.
Edit: Your code must open the browser itself, and cannot rely on an open one.
This is code-golf, so the shortest answer in bytes wins.
Your job is to open a browser window of the default browser to http://codegolf.stackexchange.com. Edit: Your code must open the browser itself, and cannot rely on an open one. This is code-golf, so the shortest answer in bytes wins. |
|||||||||||||||||||||
put on hold as unclear what you're asking by Mego, TimmyD, xnor, My Ham DJ, muddyfish 13 hours agoPlease clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question. |
|||||||||||||||||||||
|
Batch, 18 bytesSaved 3 bytes thanks to Mego.
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. |
|||||||||||||||||||||
|
Oration, 42 bytesNot winning, but sure was fun. :P I am almost beating python though, :D
So this compiles to:
I do end up needing the The code being the same as an earlier revision of @Skyler's answer is a coincidence. This is the shortest possible Oration code, and I never saw the earlier revision for his answer. The only thing I did was upvote it when it had the "import *" part. |
|||||||||||||||||||||
|
PowerShell, 17 Bytes
While |
|||
|
Terminal (OSX),
|
|
open is an OSX utility, not a bash one; this would be more appropriately called "OSX command line".
– Skyler
yesterday
|
||
|
|||
|
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.
– Skyler
yesterday
|
||
|
MATLAB,
|
|
|||
|
@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?
– Suever
yesterday
|
||
|
|||
|
@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!
– Suever
yesterday
|
||
|
@CoolestVeto So I dug a little more and it looks like the
www is unnecessary only on OS X
– Suever
yesterday
|
GNU Emacs,
|
|
|||
|
@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.
– coredump
yesterday
|
||
|
You shouldn't need the
// , I don't think. (I don't use emacs, but it's generally accepted without the // )
– CoolestVeto
yesterday
|
||
|
|||
|
Arguably this could be shortened to
(eww"ppcg.lol") sinceeww is now the default browser for Emacs itself. (browse-web is an alias for eww in the menu bar)
– Jonathan Leech-Pepin
17 hours ago
|
Bash,
|
|
|||
|
@digital_trauma interesting, it didn't for me. It looked for www.ppcg.lol on the file system. Ubuntu 15.10.
– Ogaday
yesterday
|
||
|
|||
|
|||
|
AutoHotKey, 16 bytes
|
|||||||||||||||||||||
|
Python,
|
|
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.
– Skyler
yesterday
|
||
|
|||
|
|||
|
I've always seen the
// as convention, I don't think you need it for some browsers.
– CoolestVeto
yesterday
|
||
|
You can also do this with just command line options
python -m webbrowser -t http:ppcg.lol which I think counts as 30 chars
– gnibbler♦
23 hours ago
|
Java 7, 118 bytes
Java is not the best language for golfing... Here's the same program in a more readable format:
|
|||||||||||||||||||||
|
JavaScript, 34 bytes
Uses Node.js |
|||||||||||||||||
|
R, 26 bytes
I don't know of any shorter way to do this in R. |
|||||
|
Racket, 41 bytes
|
|||
|
Java 8, 115 bytes
Java is not the best language for golfing... Here's the same program in a more readable format:
|
|||||||||||||||||||||
|
Mathematica, 28 bytes
|
|||||||||||||||||||||
|
|
|||||||||||||||||||||
|
Applescript, 28
|
||||
|
Actionscript 3, 117 bytes
Like Java, this is not a great golfing language. Here's the code with formatting:
|
||||
|
C#, 33 bytes
Opens the default browser to the web address |
|||||
|
VBScript, 57 bytesI used to have lots of fun creating tiny programs in VBScript, back in 2010. I've remembered this language and used the code on: http://stackoverflow.com/a/13401872/2729937 It still works on Windows 7, at least.
This is a bit different from the usual An alternative way would be |
|||
|
Ruby,
|
|
You can save 2 characters by using backticks instead of
%x . open http:ppcg.lol
– Daniel Evans
22 hours ago
|
||
|
VB.NET,
|
Dyalog APL, 21 bytes
Uses the User Command ]Open, which is installed with Dyalog. |
|||||||||
|
Factor,
|
|
I think you can remove the space between the end-quote and
run-process , and you can wholly drop // .
– CoolestVeto
yesterday
|
||
|
@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
– cat
yesterday
|
||
|
|||
|
|||
|
@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...")
– cat
yesterday
|
Perl 5, 66 bytesShould work everywhere, but needs that import :(
Also, for funsies : Perl 5 (Windows), 34 bytes
Perl 5 (Unix), 31 bytes
|
|||
|
NodeJS, 53 bytes
Works on mac. |
|||
05AB1E, 16 bytes (non-competing)Non-competing, since the features used here postdate the challenge. Code:
You can try the string online here. This basically evaluates to this batch answer. Uses the CP1252 encoding. |
|||||||||
|
PHP, 33 bytes
|
|||
|
R, 28 bytes
(in |
|||
|
Python,
|
|
|||
|
|||
|
|||
|
@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
yesterday
|
||
|
@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
yesterday
|