您的工作是将默认浏览器的浏览器窗口打开到http://codegolf.stackexchange.com。
您的代码必须打开浏览器本身,并且不能依赖于打开的浏览器。
这是代码高尔夫球,因此最短的答案以字节为单位。
您的工作是将默认浏览器的浏览器窗口打开到http://codegolf.stackexchange.com。
您的代码必须打开浏览器本身,并且不能依赖于打开的浏览器。
这是代码高尔夫球,因此最短的答案以字节为单位。
Answers:
(eww"ppcg.ga")
EWW是Emacs中的浏览器。该browse-web
功能是一个别名eww
,而这样就使得eww
在默认浏览器在Emacs:
您的工作是将默认浏览器的浏览器窗口打开到http://codegolf.stackexchange.com。
感谢@ CoolestVeto,@ Jonathan Leech-Pepin和@ zyabin101。
www.ppcg.lol
代替使用http://ppcg.lol
吗?
//
我不认为您不需要。(我不使用emacs,但通常不使用emacs //
)
没有赢,但是肯定很有趣。截至目前,我仅比python落后1个!
I need webbrowser
Now open "http:ppcg.ga"
说明:
I need
编译成import $1
与webbrowser
作为模块。
Now
从模块运行以下命令,以及module.command
随后的任何参数。
因此,将其编译为:
#!/usr/bin/env python3
import webbrowser
webbrowser.open("http:ppcg.ga")
我最终还是需要http:
一部分,并且不能缩短它。
"http://ppcg.lol"
为"http:ppcg.lol"
。我不确定是否可以删除空格之间open
和"http:..."
,但试试吗?
多亏了Mego,节省了3个字节。
start www.ppcg.ga
如果从Windows命令行运行它,它将在默认浏览器中打开。
我认为它也可以在Powershell中使用,但是我不确定。
start
代替explorer
。
start www.ppcg.lol
改为使用Windows隐式地将其解析为HTTP。在CMD和PowerShell中均可使用。
www.
?
open http:ppcg.ga
由于CoolestVeto节省了2
open
是OSX实用程序,不是bash实用程序;这将更合适地称为“ OSX命令行”。
//
。
open http:ppcg.ga
web www.ppcg.lol -browser
www
短于http://
并确保将地址作为URL处理web('www.ppcg.lol', '-browser')
。web ppcg.lol -browser
为MATLAB会自动附加一个http://
(21个字节)替代方案:
在Windows上,可以缩短为(19个字节)
!start www.ppcg.lol
在OS X上(21字节)
!open http://ppcg.lol
以下内容将在已部署的MATLAB应用程序中工作(16个字节)
web www.ppcg.lol
如果可以使用内置浏览器,则可以进一步减少http
隐含含义(12个字节)
web ppcg.lol
open
命令执行相同的操作。
!
在MATLAB中执行的操作,等效于system(command)
。我将其作为可以在MATLAB内执行的其他替代方案的更多示例。这可以吗?
www.
吗?
www
只有在OS X上才不需要
Run www.ppcg.lol
无耻地借用了缩短的链接。
from webbrowser import*;open("http:ppcg.ga")
多亏了CrazyPython提供了-4个字节,而Sp3000又提供了一个。
编辑:多亏了CoolestVeto,剃了2折
编辑:感谢MD XF注册ppcg.ga并保存另一个字节
//
。
python -m webbrowser -t http:ppcg.lol
来完成此操作,我认为这可以算作30个字符
ppcg.lol
已被取消注册,使该答案无效:I但是,我刚刚注册了ppcg.ga
,因此您可以改用它,无论如何保存一个字节。
xdg-open http:ppcg.lol
不像其他的那么短。firefox ppcg.lol
较短,但不符合问题规范。
xdg-open www.ppcg.lol
也为我工作。
//
。
xdg-open http:ppcg.lol
也对我有用。
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