How to effectively remove the metatag refresh from a page?

Asked

Viewed 955 times

4

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

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

I understand why you use it on the websites, but over time this functionality becomes quite annoying to the user. That’s when I got the idea to create an extension for Chrome that would remove this tag when the user wanted it. 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 this metatag with javascript / jquery?

3 answers

2


1

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

Search for Ajax o Content of the page.

Opens (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 it closes (close-up) the Document

window.document.close();

You may need to put the content in a new window because the initial one already has the goal to fire.

Good tests.

1

Chrome does not provide or 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. Chrome does not, however. There is a correction request since July/2013 without any attention. I invite those who read this to access and vote in favor of the implementation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.