Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

alya_alsiyabi's avatar

the content must be served over HTTPS.

Hi I am trying to show video from YOUTUBE in the Blade. by the following code:

                    <div class="col-lg-5 offset-lg-1 col-md-6 col-12">
                        <!-- About Video -->
                                <div class="modern-img-feature">
                            <img src="{{url('frontend/img/IoT.jpeg')}}" alt="#">
                            <div class="video-play pt-2"> 
                                <a href="{{url('https://www.youtube.com/watch?v=hZV0U6fi8YM')}}" class="video video-popup mfp-iframe">
                                    <i class="fa fa-play"></i>
                                </a>
                            </div>
                        </div>
                        <!--/End About Video  -->
                    </div>

When I use this with hostinger server the video embed works , but when I use the same code with siteground server the video embed is not working Console shows the following error:

jquery.min.js:3

   Mixed Content: The page at 'https://rakeeza.net/aboutus' was loaded over HTTPS, but requested an insecure frame 'http://www.youtube.com/embed/hZV0U6fi8YM?autoplay=1'. This request has been blocked; the content must be served over HTTPS.
0 likes
14 replies
Sinnbeck's avatar

So youtube somehow automatically changes your html? Or you are using some package?

alya_alsiyabi's avatar

@Sinnbeck I don't know what's the reason of errror, but I am using https:// not http:// as url I dont know where http:// is coming The code is running successfully in the local host and in hostinger server. But when I migrate it to siteground server it is not working

alya_alsiyabi's avatar

@Sinnbeck yes sir something from jQuery js. This one: *! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */

thinkverse's avatar

Using the url helper is great for generating absolute URLs of your application. If it's a URL of another site just use the string instead. And the url helper will not change the URL protocol so there is something else wrong that's not included in the snippet you've provided.

Change your code to not use the url helper and see if the error persists.

<a href="https://www.youtube.com/watch?v=hZV0U6fi8YM" class="video video-popup mfp-iframe">
thinkverse's avatar

@alya_alsiyabi You have a click event on the link, that triggers some JavaScript to open the video in an overlay. I'm certain the issue lies in that JavaScript because it's after that event is fired and the overlay is loaded it throws and error about mixed content. So dive into your JavaScript and see what it does after it grabs the URL.

thinkverse's avatar

@alya_alsiyabi it seems the jQuery plugin you use loads YouTube in the iframe using http - likely due to the plugin not adding a specific protocol - according to the documentation for Magnific Popup you can add options to extend it, so why not try overwriting the YouTube pattern and adding an https protocol to it and see if that fixes the mixed content error.

$('.video').magnificPopup({
  type: 'iframe',
  iframe: {
    patterns: {
        index: 'youtube.com',
        id: 'v=',
        src: 'https//www.youtube.com/embed/%id%?autoplay=1'
      }
    }
  }
});

This question is not a Laravel one so consider updating the channel to JavaScript by editing the original question and selecting JavaScript in the drop-down. 👍

alya_alsiyabi's avatar

@thinkverse sir .video as variable is not defined aboutus:2 Uncaught ReferenceError: $ is not defined at aboutus:2:1 ok I changed it to javascript

thinkverse's avatar

@alya_alsiyabi then be more specific in your selector if you have more than one element with the class video.

$('a.video.video-popup.mfp-iframe').magnificPopup({
    type: 'iframe',
    iframe: {
        patterns: {
            index: 'youtube.com',
            id: 'v=',
            src: 'https//www.youtube.com/embed/%id%?autoplay=1'
        }
    }
});

Uncaught ReferenceError: $, strange you clearly have jQuery on your site and I can access jQuery via $ in the console.

I did have an extra } in the example before so I fixed that.

alya_alsiyabi's avatar

@thinkverse I tried all of the classes , but they still not recognizing the variable ,I tried it also with id not working > is there a way to know the name of class by the way when I use this tag the video is working ifram src=""

thinkverse's avatar

@alya_alsiyabi well, it's clearly an anchor tag with the following classes video video-popup mfp-iframe, as per your snippet. So the selector 'a.video.video-popup.mfp-iframe' should grab the correct element if it's on the page.

And I do have to apologize I did miss one part in the options object, I missed the youtube key and missed a colon in the protocol.

Adding the following in a <script> tag below your jQuery and Magnific Popup script should fix your issue, I just tested it myself, and the YouTube video - About Rakeeza - does load, as this video shows.

<script>
$('a.video.video-popup.mfp-iframe').magnificPopup({
    type: 'iframe',
    iframe: {
        patterns: {
            youtube: {
                index: 'youtube.com',
                id: 'v=',
                src: 'https://www.youtube.com/embed/%id%?autoplay=1'
            }
        }
    }
});    
</script>

Please or to participate in this conversation.