diff options
-rw-r--r-- | client/src/com/vaadin/client/Util.java | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java index 7aea69a61d..bf4dca7712 100644 --- a/client/src/com/vaadin/client/Util.java +++ b/client/src/com/vaadin/client/Util.java @@ -25,11 +25,13 @@ import java.util.List; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.AnchorElement; +import com.google.gwt.dom.client.DivElement; import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.NativeEvent; import com.google.gwt.dom.client.Node; import com.google.gwt.dom.client.NodeList; import com.google.gwt.dom.client.Style; +import com.google.gwt.dom.client.Style.Display; import com.google.gwt.dom.client.Touch; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; @@ -1207,8 +1209,23 @@ public class Util { * @return the corresponding absolute URL as a string */ public static String getAbsoluteUrl(String url) { - AnchorElement a = Document.get().createAnchorElement(); - a.setHref(url); - return a.getHref(); + if (BrowserInfo.get().isIE8()) { + // The hard way - must use innerHTML and attach to DOM in IE8 + DivElement divElement = Document.get().createDivElement(); + divElement.getStyle().setDisplay(Display.NONE); + + RootPanel.getBodyElement().appendChild(divElement); + divElement.setInnerHTML("<a href='" + escapeHTML(url) + "' ></a>"); + + AnchorElement a = divElement.getChild(0).cast(); + String href = a.getHref(); + + RootPanel.getBodyElement().removeChild(divElement); + return href; + } else { + AnchorElement a = Document.get().createAnchorElement(); + a.setHref(url); + return a.getHref(); + } } } |