diff options
author | Artur Signell <artur@vaadin.com> | 2012-10-24 10:03:28 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-10-24 10:03:28 +0000 |
commit | c280cf41802d5d5025e311596f3269237ebbf9cc (patch) | |
tree | 6f94e4ef0d27612122d21ca1a216fd889e4a1a09 | |
parent | f639e5db9cee1e5a257d6876e53ea4fe85cb16b9 (diff) | |
parent | e827b05a20fa9effdc23bd9b1aa1d3a0f76e0f4f (diff) | |
download | vaadin-framework-c280cf41802d5d5025e311596f3269237ebbf9cc.tar.gz vaadin-framework-c280cf41802d5d5025e311596f3269237ebbf9cc.zip |
Merge "Make Util.getAbsoluteUrl work in IE8 (#10049)"
-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(); + } } } |