location: add href setter

* `page.navigateFromWebAPI` seem to be not working while testing; `page.navigate` is preferred instead.
This commit is contained in:
nikneym
2025-10-01 14:24:57 +03:00
committed by Halil Durak
parent 9b4ea7a040
commit cea4f052ba

View File

@@ -41,6 +41,10 @@ pub const Location = struct {
return page.navigateFromWebAPI(href, .{ .reason = .script });
}
pub fn set_href(_: *const Location, href: []const u8, page: *Page) !void {
return page.navigate(href, .{ .reason = .script });
}
pub fn get_protocol(self: *Location) []const u8 {
if (self.url) |*u| return u.get_protocol();
return "";