love.system.openURL

Available since LÖVE 0.9.1
This function is not supported in earlier versions.

Opens a URL with the user's web or file browser.

Function

Synopsis

success = love.system.openURL( url )

Arguments

string url
The URL to open. Must be formatted as a proper URL.

Returns

boolean success
Whether the URL was opened successfully.

Notes

Passing file:// scheme in Android Nougat and later always result in failure. Prior to 11.2, this will crash LÖVE instead of returning false.

Examples

Open love2d.org when the game is loaded.

function love.load()
    love.system.openURL("http://love2d.org/")
end

Open the game's save directory when "s" is pressed.

function love.load()
    -- Make sure the save directory exists by writing an empty file.
    love.filesystem.write("test.txt", "")
end

function love.keypressed(key)
    if key == "s" then
        -- To open a file or folder, "file://" must be prepended to the path.
        love.system.openURL("file://"..love.filesystem.getSaveDirectory())
    end
end

See Also

Other Languages