Search code examples
javascripthtmlvideoyoutubechm

YouTube link doesn't work in compiled CHM Help File


I copied the link from the YouTube page intended for the HTML file. In a single file it works without any problems. After compilation to CHM using HTML help workshop, it does not run and an error appears.

image of the error message

Fragment of code I use

<div>
<iframe width="420" height="315"
src="http://www.youtube.com/embed/tgbNymZ7vqY?"frameborder="0" allow="autoplay; encrypted-media" allowfullscreen>
</iframe>
</div>

I tried to use the 'iframe' function with various parameters as well as links to different files, but without success.


Solution

  • Add the following statement to the <head> section of your topic HTML file. This works for me even if the HTML topic file is compiled into a .chm help file.

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    

    e.g.

    <head>
        <title>CHM and Video Test</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="description" content="CHM example file help-info.de" />
        <link href="../design.css" rel="stylesheet" type="text/css" />
    </head>
    

    This was tested on my German Windows10 PC using FAR HTML and Microsoft HTMLHelp Workshop.

    A short HTML code snippet that matches the attached image.

    <h1>CHM and Video Test</h1>
    
    <p><iframe width="320" height="200" src="http://www.youtube.com/embed/tgbNymZ7vqY?" frameborder="0" allowfullscreen="true" allow="accelerometer; autoplay; encrypted-media; fullscreen; gyroscope; picture-in-picture"></iframe></p>
    
    <p>Compiled by HTMLHelp Workshop using FAR HTML: <a href="https://www.help-info.de/en/far-html/far-features/">FAR HTML Features</a></p>
    
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam
      Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod 
      tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. 
      At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, 
      no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
    

    This is resulting in:

    enter image description here