1

How to disable meta refresh tag in Google Chrome using Java Script?

I Have tried removing meta refresh tag as shown below,

    $('meta[http-equiv=Refresh]').remove()

This works fine in IE & firefox.

MPelletier
  • 16,256
  • 15
  • 86
  • 137
krishna
  • 807
  • 2
  • 11
  • 19
  • 1
    Repeated question. See http://stackoverflow.com/questions/2568760/is-it-possible-to-use-javascript-to-change-the-meta-tags-of-the-page –  Mar 21 '12 at 14:27
  • Extension related: http://stackoverflow.com/questions/7720461/is-it-possible-to-disable-meta-refresh-in-google-chrome – XP1 Dec 01 '12 at 06:12

2 Answers2

0

You cannot disable meta refresh by manipulating the DOM. It does not work anymore.

The workaround is to retrieve the original markup, find and replace the meta refresh element, and then write the new document with the replaced markup.

Although I have not tested this technique in Chrome, it works in Opera. Here is my code:

Using Javascript to override or disable meta refresh tag

Community
  • 1
  • 1
XP1
  • 6,910
  • 8
  • 54
  • 61
0

You can call window.stop() in a load event handler. At least chrome does not actually start the refresh timer untilm the page has successfully loaded, and calling stop this way will stop the refresh once the page is considered to be fully loaded.

Remember Monica
  • 3,897
  • 1
  • 24
  • 31