diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index 43e742f70bf..0477e9180e2 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -141,6 +141,9 @@ static const WCHAR onselectstartW[] = {'o','n','s','e','l','e','c','t','s','t','
static const WCHAR submitW[] = {'s','u','b','m','i','t',0};
static const WCHAR onsubmitW[] = {'o','n','s','u','b','m','i','t',0};
+static const WCHAR unloadW[] = {'u','n','l','o','a','d',0};
+static const WCHAR onunloadW[] = {'o','n','u','n','l','o','a','d',0};
+
static const WCHAR HTMLEventsW[] = {'H','T','M','L','E','v','e','n','t','s',0};
static const WCHAR KeyboardEventW[] = {'K','e','y','b','o','a','r','d','E','v','e','n','t',0};
static const WCHAR MouseEventW[] = {'M','o','u','s','e','E','v','e','n','t',0};
@@ -239,7 +242,9 @@ static const event_info_t event_info[] = {
{selectstartW, onselectstartW, EVENTT_MOUSE, DISPID_EVMETH_ONSELECTSTART,
EVENT_CANCELABLE},
{submitW, onsubmitW, EVENTT_HTML, DISPID_EVMETH_ONSUBMIT,
- EVENT_DEFAULTLISTENER|EVENT_BUBBLE|EVENT_CANCELABLE|EVENT_HASDEFAULTHANDLERS}
+ EVENT_DEFAULTLISTENER|EVENT_BUBBLE|EVENT_CANCELABLE|EVENT_HASDEFAULTHANDLERS},
+ {unloadW, onunloadW, EVENTT_HTML, DISPID_EVMETH_ONUNLOAD,
+ EVENT_FIXME}
};
eventid_t str_to_eid(LPCWSTR str)
diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h
index f723ef64040..cc16fd8ff9a 100644
--- a/dlls/mshtml/htmlevent.h
+++ b/dlls/mshtml/htmlevent.h
@@ -49,6 +49,7 @@ typedef enum {
EVENTID_SCROLL,
EVENTID_SELECTSTART,
EVENTID_SUBMIT,
+ EVENTID_UNLOAD,
EVENTID_LAST
} eventid_t;
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 5f46c2a5570..2e33c0b4a7b 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -1128,15 +1128,19 @@ static HRESULT WINAPI HTMLWindow2_get_onbeforeunload(IHTMLWindow2 *iface, VARIAN
static HRESULT WINAPI HTMLWindow2_put_onunload(IHTMLWindow2 *iface, VARIANT v)
{
HTMLWindow *This = impl_from_IHTMLWindow2(iface);
- FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
+
+ return set_window_event(This, EVENTID_UNLOAD, &v);
}
static HRESULT WINAPI HTMLWindow2_get_onunload(IHTMLWindow2 *iface, VARIANT *p)
{
HTMLWindow *This = impl_from_IHTMLWindow2(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ return get_window_event(This, EVENTID_UNLOAD, p);
}
static HRESULT WINAPI HTMLWindow2_put_onhelp(IHTMLWindow2 *iface, VARIANT v)