1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:47:36 +00:00

LibWeb: Fix js execution for js urls in anchor tags href

This commit is contained in:
PrestonLTaylor 2023-06-26 20:04:14 +01:00 committed by Andreas Kling
parent 1a10e904b5
commit 0eac8bce6f
4 changed files with 38 additions and 17 deletions

View file

@ -286,7 +286,7 @@ bool EventHandler::handle_mouseup(CSSPixelPoint position, unsigned button, unsig
dbgln("Web::EventHandler: Clicking on a link to {}", url);
if (button == GUI::MouseButton::Primary) {
if (href.starts_with("javascript:"sv)) {
document->run_javascript(href.substring_view(11, href.length() - 11));
document->navigate_to_javascript_url(href);
} else if (!url.fragment().is_null() && url.equals(document->url(), AK::URL::ExcludeFragment::Yes)) {
m_browsing_context->scroll_to_anchor(url.fragment());
} else {