【发布时间】:2016-01-18 09:19:21
【问题描述】:
我正在我的 jquery ui 对话框中播放 youtube 嵌入视频,其中包含 iframe。在 dialogClose 事件中,我清除了 iframe src,但它会将页面重定向/回发到该 url。这是我的代码:
HTML:
<div id="videoDialog" title="Video Player">
<iframe id="videoPlayer" src="" width="100%" height="500" style="border: 0px;" sandbox="allow-same-origin allow-scripts allow-popups allow-forms"></iframe>
</div>
JS:
var $videoDialog = $("#videoDialog").dialog({
autoOpen: false,
width: 900,
height: "auto",
modal: true
}),
$iframeVideoPlayer = $("#videoPlayer");
$(".video").on("click", function(){
$iframeVideoPlayer.prop("src", $(this).data("src"));
$videoDialog.dialog("open");
});
$videoDialog.on("dialogclose", function(event) {
$iframeVideoPlayer.prop("src", "");//i set empty src here to iframe and it redirects the page
});
请帮忙。
它只发生在 android webview 中。在桌面浏览器中它工作正常
【问题讨论】:
标签: javascript android jquery iframe android-webview