在我的GWT應用程序中,我通過Recurly接收付款,並在IFrame中使用Recurly的頁面。當Recurly成功處理付款時,他們的頁面會重定向到我提供的成功URL,它會以POST
命中我的servlet。收到POST
後,我想關閉IFrame並對我的小部件執行操作。我關閉使用JavaScript的IFrame的響應:在GWT應用程序中,如何使用doPost的響應來關閉IFrame
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
/* other code */
StringBuilder buf = new StringBuilder();
buf.append("<script language=\"javascript\" type=\"text/javascript\">");
buf.append("var n = window.parent.document.getElementById(\"recurly-popup\");");
buf.append("n.parentNode.removeChild(n);");
buf.append("</script>");
response.getOutputStream().print(buf.toString());
}
不過,我似乎無法找到任何方式在iframe是關閉了客戶端上檢測到。我如何使用GWT或GWTQuery檢測它?