我想允许用户输入他们的URL并浏览iframe。 他们点击确认按钮后,我会从iframe中浏览网址。GWT阻止了源自“http:// localhost”的框架访问跨源框架
IFrameElement frame = IFrameElement.as(DOM.createIFrame());
frame.setSrc("http://www.example.com"); //set the url of user enter
VerticalPanel ver = new VerticalPanel();
ver.getElement().appendChild(frame);
// After they click the confirm button, get the url from iframe
Window.alert(frame.getContentDocument().getURL());
,但我得到一个错误后,我得到的iframe网址
异常:com.google.gwt.event.shared.UmbrellaException:陷入异常 :(引发SecurityError):封锁框架原产地 “http://localhost”不能访问跨源帧。