mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 17:28:10 +00:00
LibWeb: Allow navigating to a new URL by setting window.location.href
This commit is contained in:
parent
1ec4db04cd
commit
efdfdbabdb
5 changed files with 32 additions and 3 deletions
|
@ -30,7 +30,10 @@
|
|||
#include <LibJS/Interpreter.h>
|
||||
#include <LibJS/Runtime/Function.h>
|
||||
#include <LibJS/Runtime/MarkedValueList.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/Frame.h>
|
||||
#include <LibWeb/HtmlView.h>
|
||||
|
||||
namespace Web {
|
||||
|
||||
|
@ -105,4 +108,15 @@ void Window::cancel_animation_frame(i32 id)
|
|||
GUI::DisplayLink::unregister_callback(id);
|
||||
}
|
||||
|
||||
void Window::did_set_location_href(Badge<Bindings::LocationObject>, const String& new_href)
|
||||
{
|
||||
auto* frame = document().frame();
|
||||
if (!frame)
|
||||
return;
|
||||
auto* view = frame->html_view();
|
||||
if (!view)
|
||||
return;
|
||||
view->load(new_href);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue