How to effectively remove the refresh meta tag from a page?

4

Lately I have accessed several news sites that use this meta tag to update their pages from time to time:

<meta http-equiv="refresh" content="300">

I understand the reason for using it from sites, but over time this functionality becomes quite annoying to the user. That's when I had the idea of creating an extension for Chrome that would remove that tag when the user wanted to. But what happens is that even removing it from the DOM, after a certain number of seconds the page suffers refresh in the same way.

So my question is:

Is there any way to effectively remove or disable the operation of this meta tag with javascript / jquery?

    
asked by anonymous 31.01.2014 / 21:46

3 answers

2

It is possible, even with a trick: stopping redirection is not possible, but you can cancel it by making the page redirect to an address that returns HTTP 204 . p>

If you want an extension that does this, use this (the explanation above is the description of the extension):

    
31.01.2014 / 22:12
1

I only see one approach, your script should reload the entire page by removing the meta refresh.

Search for Ajax Page Contents.

Open ( open ) the document

window.document.open();

Save the new content ( write ) without the meta refresh, use replace

window.document.write(NOVO_HTML.replace(/<meta http-equiv="refresh".*\/?>/gi, ""));

Then close ( close ) the document

window.document.close();

It may be necessary to put the content in a new window because the initial one is already with the goal to shoot.

Good testing.

    
31.01.2014 / 22:19
1

Chrome does not provide or even allow an easy way to disable http refresh, another problem is that it is not possible to 'intercept' the content of a request before it is rendered by the browser via api.

The refresh by meta-equiv can be disabled in most browsers through user settings. But Chrome does not. There is a correction request since July 2013 without any attention. I urge anyone reading this to sign in and vote for implementation.

    
31.01.2014 / 23:21