diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 3ee2273fc67..a0cf108cf36 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -1431,8 +1431,15 @@ static HRESULT WINAPI HTMLWindow3_attachEvent(IHTMLWindow3 *iface, BSTR event, I
static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp)
{
HTMLWindow *This = impl_from_IHTMLWindow3(iface);
- FIXME("(%p)->()\n", This);
- return E_NOTIMPL;
+
+ TRACE("(%p)->()\n", This);
+
+ if(!This->doc) {
+ FIXME("No document\n");
+ return E_FAIL;
+ }
+
+ return detach_event(This->doc->body_event_target, &This->doc->basedoc, event, pDisp);
}
static HRESULT window_set_timer(HTMLWindow *This, VARIANT *expr, LONG msec, VARIANT *language,