Ваша задача - открыть окно браузера браузера по умолчанию на http://codegolf.stackexchange.com .
Ваш код должен открывать сам браузер и не может полагаться на открытый.
Это код-гольф , поэтому выигрывает самый короткий ответ в байтах.
Ваша задача - открыть окно браузера браузера по умолчанию на http://codegolf.stackexchange.com .
Ваш код должен открывать сам браузер и не может полагаться на открытый.
Это код-гольф , поэтому выигрывает самый короткий ответ в байтах.
Ответы:
(eww"ppcg.ga")
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.
www.ppcg.lol
instead of http://ppcg.lol
?
//
, I don't think. (I don't use emacs, but it's generally accepted without the //
)
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.
"http://ppcg.lol"
with "http:ppcg.lol"
. I'm uncertain whether you can remove the space between open
and "http:..."
, but try it?
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.
start
instead of explorer
.
start www.ppcg.lol
instead to implicitly have Windows parse it as HTTP. Works in both CMD and PowerShell.
www.
?
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.
open http:ppcg.ga
Saved 2 thanks to CoolestVeto
open
is an OSX utility, not a bash one; this would be more appropriately called "OSX command line".
//
.
open http:ppcg.ga
web www.ppcg.lol -browser
www
is shorter than http://
and ensures that the address is processed as a URLweb('www.ppcg.lol', '-browser')
.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
open
command does the same.
!
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?
www.
?
www
is unnecessary only on OS X
Run www.ppcg.lol
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
//
.
python -m webbrowser -t http:ppcg.lol
which I think counts as 30 chars
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.
xdg-open http:ppcg.lol
Not as short as some others. firefox ppcg.lol
is shorter, but it doesn't meet question spec.
xdg-open www.ppcg.lol
works for me as well.
//
.
xdg-open http:ppcg.lol
also works for me.
class P{public static void main(String[]a)throws Exception{java.awt.Desktop.getDesktop().browse(new java.net.URI("http://ppcg.lol"));}}
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:ppcg.ga"));
}
}
Saved 2 bytes by removing //
in the URI/L, and another byte by switching to .ga
from .lol
(indirectly thanks to @Milo)
"http://ppcg.lol"
with "http:ppcg.lol"
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)
//
.
interface
is longer than class
, you save more bytes because the public
modifier is implied.
require('open')('http://ppcg.lol')
Uses Node.js
//
?
require`open``http://ppcg.lol`;
(added ;
to avoid tripping the formatting)
require('open')('//ppcg.lol')
to save 5 bytes
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.
(require net/sendurl)(send-url"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.
open location"http:ppcg.lol"
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.
SystemOpen@"http://ppcg.lol"
//
?
shell.exec("www.ppcg.lol")
I don't know of any shorter way to do this in R.
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.
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")
}
}
}
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.
Should work everywhere, but needs that import :(
8 bytes saved with @msh210 comment.
use Browser::Open open_browser;open_browser"http:ppcg.ga"
Also, for funsies :
system "start http://www.ppcg.ga"
system "xdg-open http:ppcg.ga"
-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.)
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.
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. Also, couldn't the space between BROWSE
and "
be removed, saving another byte?
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"
.
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.
Process.Start("http://ppcg.lol");
Opens the default browser to the web address
\\
via //
.
System.Diagnostics
namespace to be added in or Process
to be fully qualified to work.
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.
Non-competing, since the features used here postdate the challenge. Code:
’…Ò ™³.ÐÏg.´¢’.E
You can try the string online here. This basically evaluates to this batch answer.
Uses the CP1252 encoding.
Process.Start("http:ppcg.lol")
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
.
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.
[ "http:ppcg.ga" open-url ]
I didn't know one could golf-off the //
in the protocol.
run-process
, and you can wholly drop //
.
//
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
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...")
from webbrowser import*;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:
from webbrowser import * # Loads everything in the webbrowser module
open("http://ppcg.ga/") # Opens default browser to http://ppcg.ga/
from webbrowser import*;open('http:gfa1.tk')
URL from this answer
Ungolfed:
from webbrowser import * # Loads everything in the webbrowser module
open("http://gfa1.tk/") # Opens default browser to http://gfa1.tk/
from webbrowser import*;open('http:ppcg.lol')
Ungolfed:
from webbrowser import * # Loads everything in the webbrowser module
open('http://ppcg.lol/') # Opens default browser to http://ppcg.lol/
Take that, ppcg.lol! (1 byte shorter)
Note: I added a separate answer leading to ppcg.lol, 'cause I've noticed the other sites doesn't work for me in Internet explorer 11, and I saw other users having this problem too.
Both are non-non-competing (read that right?)
`open http:ppcg.ga`
Simple.
Thanks to Daniel for 2 bytes off.
%x
. open http:ppcg.lol
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