diff --git a/Applications/Browser/Tab.cpp b/Applications/Browser/Tab.cpp index b16b0f79b5..daaba4a027 100644 --- a/Applications/Browser/Tab.cpp +++ b/Applications/Browser/Tab.cpp @@ -133,7 +133,7 @@ Tab::Tab() update_bookmark_button(url.to_string()); }; - m_html_widget->on_link_click = [this](auto& url) { + m_html_widget->on_link_click = [this](auto& url, auto&) { if (url.starts_with("#")) { m_html_widget->scroll_to_anchor(url.substring_view(1, url.length() - 1)); } else { diff --git a/Applications/Help/main.cpp b/Applications/Help/main.cpp index 75cf67d95f..26c69255b5 100644 --- a/Applications/Help/main.cpp +++ b/Applications/Help/main.cpp @@ -151,7 +151,7 @@ int main(int argc, char* argv[]) open_page(path); }; - html_view.on_link_click = [&](const String& href) { + html_view.on_link_click = [&](const String& href, auto&) { char* current_path = strdup(history.current().characters()); char* dir_path = dirname(current_path); char* path = realpath(String::format("%s/%s", dir_path, href.characters()).characters(), nullptr); diff --git a/Libraries/LibWeb/DOM/HTMLAnchorElement.h b/Libraries/LibWeb/DOM/HTMLAnchorElement.h index a663b718d9..e823dff76a 100644 --- a/Libraries/LibWeb/DOM/HTMLAnchorElement.h +++ b/Libraries/LibWeb/DOM/HTMLAnchorElement.h @@ -36,6 +36,7 @@ public: virtual ~HTMLAnchorElement() override; String href() const { return attribute("href"); } + String target() const { return attribute("target"); } }; template<> diff --git a/Libraries/LibWeb/HtmlView.cpp b/Libraries/LibWeb/HtmlView.cpp index 245f371fca..d4aa3f09f0 100644 --- a/Libraries/LibWeb/HtmlView.cpp +++ b/Libraries/LibWeb/HtmlView.cpp @@ -238,7 +238,7 @@ void HtmlView::mousedown_event(GUI::MouseEvent& event) run_javascript_url(link->href()); } else { if (on_link_click) - on_link_click(link->href()); + on_link_click(link->href(), link->target()); } } else { if (event.button() == GUI::MouseButton::Left) { diff --git a/Libraries/LibWeb/HtmlView.h b/Libraries/LibWeb/HtmlView.h index 2b7c97aeb1..ddf830e3a8 100644 --- a/Libraries/LibWeb/HtmlView.h +++ b/Libraries/LibWeb/HtmlView.h @@ -57,7 +57,7 @@ public: void set_should_show_line_box_borders(bool value) { m_should_show_line_box_borders = value; } - Function on_link_click; + Function on_link_click; Function on_link_hover; Function on_title_change; Function on_load_start;