在GWT
應用程序中,我嘗試打開一個傳遞包含查詢參數的url
的Window
。碰巧有一個參數被命名爲:deg_test
,所以格式化的url類似於:http://localhost:8888/mymodule/search?param1=value1¶m2=value2°_test=123
。GWT Window.open在IE 11中曲解查詢參數&deg = 123
在Chrome
和Firefox
窗口打開如預期,但在IE 11
的°_
部分被誤解爲°
和它轉換爲度符號(°),並打破了網址!
樣品的編號:
String query = "?param1=value1¶m2=value2°_test=123";
com.google.gwt.user.client.Window.open("http://localhost:8888/mymodule/search"
+ URL.encode(query), "_blank", "resizable=yes"
IE窗口URL:http://localhost:8888/mymodule/search?param1=value1¶m2=value2°_test=123
如果我使用URL.encodeQueryString
方法而不是URL.encode
既?
和&
將被編碼和服務器將與404
謝謝!事實上,建議的解決方法將工作,但事實是,在實際應用程序中,我有多個「deg _...」參數,這些參數被任意添加爲查詢參數,因此這最終不能解決我的問題。我會提高你的答案,但恐怕我不能接受它作爲解決方案。 – pleft
其實你的鏈接到另一個問題導致我解決我的問題。非常感謝,標誌着這是正確的答案! – pleft