Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove meta tag refresh

My site has a refresh tag like this:

<meta http-equiv='refresh' content='400'>

I have some vídeos embedded and when they're playing I want to remove the refresh.

In a specific function that detects when video is playing I did this using JQuery:

$("meta[http-equiv='refresh']").remove();

But the page still refreshes after 400 secs.

Is there a way to solve this?

like image 751
Seralto Avatar asked Jun 22 '26 20:06

Seralto


1 Answers

Removing the meta tag isn't an option, based on the link Robert Rozas added --> Using Javascript to override or disable meta refresh tag

Since I don't have your code I can't help completely, but below is a way to auto refresh the page on load & then stop refreshing it on an event.

Clicking on the Test Button will stop the refresh.. just hook this into your event and it should solve your problem -->

 <script>
$(document).ready(function () {
     $("#test").click(function (e) {
        // This event will clear the timeout
            clearTimeout(timeout);
     });

 var timeout = setTimeout(function()
{
    // The refresh is occurring here
    location.reload();
}, 4000);

});
 </script>
 <button id="test">Test</button>

The following will remove the meta tag (quotes removed)

 $('meta[http-equiv=refresh]').remove();
like image 114
ejhost Avatar answered Jun 28 '26 13:06

ejhost