Android WebView: Define iframe src page redirection


I am playing a youtube embeded video in my jquery ui dialog which has iframe in it. On dialogClose event i clear the iframe src but it redirects/postback the page to that url. here is my code:


<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>


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.on("dialogclose", function(event) {
     $iframeVideoPlayer.prop("src", "");//i set empty src here to iframe and it redirects the page

Please help.

Its only happening inside android webview. In desktop browsers it is working fine

Have you tried using the beforeClose event?