Add close Botton to IFRAME in ASP.Net

Last Reply 5 months ago By dharmendr

Posted 5 months ago

I want to display youtube on webform ,but also want to close option on video ?

<iframe width="560" height="315" src="https://www.youtube.com/embed/1V5gzqBe5j4?rel=0&autoplay=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

 

You are viewing reply posted by: dharmendr 5 months ago.
Posted 5 months ago

Hi akhter,

You could put anchor link into some kind of container like div for your iframe.

Check this example. Now please take its reference and correct your code.

HTML

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <div>
        <iframe style="float: left;" width="560" height="315" src="https://www.youtube.com/embed/1V5gzqBe5j4?rel=0&autoplay=1" frameborder="0"
            allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
            allowfullscreen></iframe>
        <a href='javascript:void(0)' style="color: Red; float: left;" onclick='this.parentNode.parentNode.removeChild(this.parentNode)'>X</a>
    </div>
</body>
</html>

Demo