diff --git a/Tests/LibWeb/Text/expected/no-window-resize-on-load.txt b/Tests/LibWeb/Text/expected/no-window-resize-on-load.txt
new file mode 100644
index 00000000000..6e2c76e43db
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/no-window-resize-on-load.txt
@@ -0,0 +1 @@
+resize count: 0
diff --git a/Tests/LibWeb/Text/input/no-window-resize-on-load.html b/Tests/LibWeb/Text/input/no-window-resize-on-load.html
new file mode 100644
index 00000000000..f6f061b85b7
--- /dev/null
+++ b/Tests/LibWeb/Text/input/no-window-resize-on-load.html
@@ -0,0 +1,12 @@
+
+
+
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index 6eb875b2a4c..c650f048895 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -2553,11 +2553,14 @@ void Document::run_the_resize_steps()
// fire an event named resize at the Window object associated with doc.
auto viewport_size = viewport_rect().size().to_type();
+ bool is_initial_size = !m_last_viewport_size.has_value();
+
if (m_last_viewport_size == viewport_size)
return;
m_last_viewport_size = viewport_size;
- window()->dispatch_event(DOM::Event::create(realm(), UIEvents::EventNames::resize));
+ if (!is_initial_size)
+ window()->dispatch_event(DOM::Event::create(realm(), UIEvents::EventNames::resize));
schedule_layout_update();
}
diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h
index e6e2b0d2c11..1ea000d879f 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.h
+++ b/Userland/Libraries/LibWeb/DOM/Document.h
@@ -786,7 +786,7 @@ class Document
bool m_page_showing { false };
// Used by run_the_resize_steps().
- Gfx::IntSize m_last_viewport_size;
+ Optional m_last_viewport_size;
HashTable m_viewport_clients;