How to disable http-equiv update in JavaScript?

I am creating a status page that should be updated periodically.

So, I updated http-equiv in the <head> section to refresh the page every minute:

 <meta http-equiv="Refresh" id="refresh" content="60"/> 

But for a browser that supports JavaScript, I would like to send an Ajax request, checking if the page should be updated or not. So, I would like to disable the http-equiv update in JavaScript (because it is Ajax that will do the job).

I tried removing the tag using JavaScript / PrototypeJs, but this does not work:

  $('refresh').remove(); 

It seems that the browser is monitoring this timer and does not care about this DOM update.

Any idea?

+4
source share
3 answers

Not quite sure, but maybe:

 <noscript> <meta http-equiv="Refresh" id="refresh" content="60"/> </noscript> 
+8
source

This will be better handled on the server. There are many tools that allow you to reliably check whether the browser supports JS (BrowserHawk is the one that comes to mind), or you can check the SupportsECMAScript property (in ASP.NET) of the Browser object and write different code if the browser supports JS.

0
source

I do not think there is a way to disable the http-equiv update.

Is the status page the first page in your application? If not, why not get the customer experience before requesting a status page? If this is the case, you may have to enter a page without an interface that captures the capabilities of the browser and instantly sends back to the real status page. All of this assumes that you do not want to use the user agent string in the HTTP header to enable the browser.

0
source

All Articles