X
Tap here to go to the mobile version of the site.

Support Forum

firefox 6.0, extension getfilesize, last modified time always return "2011.05.16 xxx", it seemed there is bug in XMLHTTP.getResponseHeader('Last-Modified') ?

Posted

file: chrome\content\load.js there is some bug, so firefox 4.0 can't run it correct. then i modify the source code as following:

function get_file_meta(url, callback, strings) {

   XMLHTTP = new XMLHttpRequest();
   XMLHTTP.open("HEAD", url, true);
   XMLHTTP.url = url;
   XMLHTTP.callback = callback;
   XMLHTTP.strings = strings;
   XMLHTTP.onreadystatechange = function()
   {
       if(XMLHTTP.url && 4 == XMLHTTP.readyState)
       {
           var size = XMLHTTP.getResponseHeader('Content-Length');
           var stime = XMLHTTP.getResponseHeader('Last-Modified');
           XMLHTTP.url = ;

           var str_size = ;

           var str_time = ;

           if(size)
           {
               var strings = XMLHTTP.strings;
               str_size = strings.getString("Size") + ': ' + format_size(size, strings) + (size > 1024 ? ' (' + size + ' ' + strings.getString("bytes") + ')' : );

               var time_str = '-';
               if(stime)
               {
                   var t = new Date(stime);
                   time_str = t.toLocaleString();
               }
               str_time = strings.getString("Last modified") + ': ' + time_str;
           }
           XMLHTTP.callback(str_size, str_time);
file: chrome\content\load.js there is some bug, so firefox 4.0 can't run it correct. then i modify the source code as following: function get_file_meta(url, callback, strings) { XMLHTTP = new XMLHttpRequest(); XMLHTTP.open("HEAD", url, true); XMLHTTP.url = url; XMLHTTP.callback = callback; XMLHTTP.strings = strings; XMLHTTP.onreadystatechange = function() { if(XMLHTTP.url && 4 == XMLHTTP.readyState) { var size = XMLHTTP.getResponseHeader('Content-Length'); var stime = XMLHTTP.getResponseHeader('Last-Modified'); XMLHTTP.url = ''; var str_size = ''; var str_time = ''; if(size) { var strings = XMLHTTP.strings; str_size = strings.getString("Size") + ': ' + format_size(size, strings) + (size > 1024 ? ' (' + size + ' ' + strings.getString("bytes") + ')' : ''); var time_str = '-'; if(stime) { var t = new Date(stime); time_str = t.toLocaleString(); } str_time = strings.getString("Last modified") + ': ' + time_str; } XMLHTTP.callback(str_size, str_time);

Additional System Details

Installed Plug-ins

  • Google Talk Plugin Video Accelerator version:0.1.43.5
  • Version 1.9.2.0
  • Office Plugin for Netscape Navigator
  • npaliedit
  • Adobe PDF Plug-In For Firefox and Netscape
  • npdivxplayerplugin
  • BitCometAgent v1.19 for Firefox
  • 6.0.12.709
  • RealPlayer(tm) LiveConnect-Enabled Plug-In
  • RealJukebox Netscape Plugin
  • The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
  • NPRuntime Script Plug-in Library for Java(TM) Deploy
  • Fetion scriptability Plugin for Firefox and Netscape
  • Google Update
  • richinfo cxdnd(3) plugin
  • richinfo screensnapshot plugin
  • richinfo mail139 ActiveX plugin
  • richinfo mailtoolautoupdate plugin
  • Shockwave Flash 10.2 r153
  • iTunes Detector Plug-in
  • GEPlugin
  • Next Generation Java Plug-in 1.6.0_26 for Mozilla browsers
  • Yahoo Application State Plugin version 1.0.0.7
  • 4.0.60531.0
  • 6.0.12.448
  • Thunder DapCtrl COM Component FireFox Plugin
  • Nitro PDF Plug-In For Firefox and Netscape
  • np-mswmp

Application

  • User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0

More Information

press a zip file url in address bar, a downthemall extension popup a window to ask where to do with the download file,
in normal case, the window will show two addtion text line (if install getfilesize extension), which say the file's size and last modified time,
but in firefox 6.0, the modified time value always be the same value: 2011.05.16 xxxx

Question owner

well, i got it, it's the extension: "better cache" modified the http head info.

well, i got it, it's the extension: "better cache" modified the http head info.