diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 0464e0597b0..e70131ff7e0 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -1179,6 +1179,33 @@ static nsrefcnt NSAPI nsURIContentListener_Release(nsIURIContentListener *iface)
return nsIWebBrowserChrome_Release(NSWBCHROME(This));
}
+static BOOL translate_url(HTMLDocument *doc, nsIWineURI *nsuri)
+{
+ OLECHAR *new_url = NULL, *url;
+ BOOL ret = FALSE;
+ LPCWSTR wine_url;
+ HRESULT hres;
+
+ if(!doc->hostui)
+ return FALSE;
+
+ nsIWineURI_GetWineURL(nsuri, &wine_url);
+
+ url = heap_strdupW(wine_url);
+ hres = IDocHostUIHandler_TranslateUrl(doc->hostui, 0, url, &new_url);
+ heap_free(url);
+ if(hres != S_OK || !new_url)
+ return FALSE;
+
+ if(strcmpW(url, new_url)) {
+ FIXME("TranslateUrl returned new URL %s -> %s\n", debugstr_w(url), debugstr_w(new_url));
+ ret = TRUE;
+ }
+
+ CoTaskMemFree(new_url);
+ return ret;
+}
+
static nsresult NSAPI nsURIContentListener_OnStartURIOpen(nsIURIContentListener *iface,
nsIURI *aURI, PRBool *_retval)
{
@@ -1222,12 +1249,15 @@ static nsresult NSAPI nsURIContentListener_OnStartURIOpen(nsIURIContentListener
IMoniker_Release(mon);
}
+
+ *_retval = FALSE;
+ }else if(This->doc) {
+ *_retval = translate_url(This->doc, wine_uri);
}
nsIWineURI_Release(wine_uri);
- *_retval = FALSE;
- return This->content_listener
+ return !*_retval && This->content_listener
? nsIURIContentListener_OnStartURIOpen(This->content_listener, aURI, _retval)
: NS_OK;
}