diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 367779b970a..3626d8a4687 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -257,6 +258,23 @@ Tab::Tab(BrowserWindow& window) m_dom_inspector_widget->inspect(); }; + view().on_url_updated = [this](auto const& url, auto history_behavior) { + switch (history_behavior) { + case Web::HTML::HistoryHandlingBehavior::Push: + m_history.push(url, m_title); + break; + case Web::HTML::HistoryHandlingBehavior::Replace: + m_history.replace_current(url, m_title); + break; + } + + auto url_serialized = url.serialize(); + m_location_box->set_text(url_serialized); + + update_actions(); + update_bookmark_button(url_serialized); + }; + view().on_navigate_back = [this]() { go_back(1); };