【发布时间】:2018-05-31 10:04:17
【问题描述】:
我想允许用户输入他们的网址并在 iframe 中浏览。 在他们点击确认按钮后,我会从 iframe 中获取浏览的 url。
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 获取 url 后出现错误
异常:com.google.gwt.event.shared.UmbrellaException:异常 捕获:(SecurityError):阻止了具有原点的帧 “http://localhost”访问跨域框架。
【问题讨论】:
标签: javascript iframe gwt