openURL
Ask the system to open the given url. http:// and https:// urls can be opened. returns true if the backend reports the URL was opened.
Only valid between Window.beginand Window.end.
Parameters
- opts:OpenURLOptions
- OpenURLOptions
Source
Implementation
pub fn openURL(opts: OpenURLOptions) bool {
const parsed = std.Uri.parse(opts.url) catch return false;
if (!std.ascii.eqlIgnoreCase(parsed.scheme, "http") and
!std.ascii.eqlIgnoreCase(parsed.scheme, "https"))
{
return false;
}
if (parsed.host != null and parsed.host.?.isEmpty()) {
return false;
}
const cw = currentWindow();
cw.backend.openURL(opts.url, opts.new_window) catch |err| {
logError(@src(), err, "Could not open url '{s}'", .{opts.url});
return false;
};
return true;
}