vbscriptmodal-dialogtagswindowhta

Why does my video not show up in a modal dialog window in my VBS HTA app?


I am trying to create a modal dialog in my app where a video shows up but it doesn't. But when I open the window without using the modal dialog function in the main hta (vbs) it works perfectly.

Video Player.hta (modal dialog):

<html>
    <meta http-equiv="x-ua-compatible" content="ie=9" />

<head>
    <title>Video Player</title>
    <HTA:APPLICATION ID="oHTA" APPLICATIONNAME="Video Player" BORDER="Dialog" CAPTION="Yes"
        SCROLL="No" SHOWINTASKBAR="Yes" SINGLEINSTANCE="Yes" SYSMENU="Yes">
</head>

<body>
    <video width="320" height="240" controls>
        <source src="C:\Users\20200791\Desktop\Repos\Audio-Go\movie.mp4">
    </video>
</body>

</html>

Main hta func:

Sub VideoButton_OnClick
    If Not document.getElementById("mp3Selector").value = "" Then
        Set FSO = CreateObject("Scripting.FileSystemObject")
        Pause
        FSO.CopyFile document.getElementById("mp3Selector").value, "C:\Users\20200791\Desktop\Repos\Audio-Go\movie.mp4"
        Window.showModalDialog "hta\VideoPlayer.hta", "", "dialogHeight: 228px; dialogWidth: 300px;"
        FSO.DeleteFile "C:\Users\20200791\Desktop\Repos\Audio-Go\movie.mp4"
    End If
End Sub

When I run the app the only thing that shows up when I press the VideoButton is a blank window with the title "Video Player"


Solution

  • HTA modal dialogs (using ShowModalDialog) run in a max of IE=8 mode, which does not support <video> tags.

    Options:

    1. Redesign your HTA to not use ShowModalDialog.

    2. Convert your HTA to a VBSEdit HTML app which includes an improved modal dialog function (window.external.CustomDialog) that runs up to IE=11 mode.

    FYI: VBSEdit is from a developer in Paris, France.