Jump to content

Jani

Members
  • Posts

    4
  • Joined

  • Last visited

Jani's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Yeah that's why it wasn't working for me. I will probably have to install a webserver to get this to run, but that seems like a big thing to do just for a small conveniance-script
  2. *sigh*This looks like it should be working, but I don't get any headers!If I do xmlhttp.getAllResponseHeaders() I get null as the result.I get the content of the files (even when doing a "HEAD" request), but I don't get the headers... anyone know why???I made a simple test out of some code I googled:function newRequest(){ var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } } return xmlhttp;}function test(){ xmlhttp = newRequest(); xmlhttp.open("HEAD", "doc.txt",true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { alert('statusText = '+xmlhttp.statusText+'\nresponseText = '+xmlhttp.responseText+'\nAllResponseHeaders = '+xmlhttp.getAllResponseHeaders()) } } xmlhttp.send(null)}The alert pops up with a blank statusText, responseText containing the content of doc.txt and AllResponseHeaders = null
  3. Excellent, thank you guys!I even found an example to do this using Ajax: xmlhttp.open("HEAD", "/faq/index.html",true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { alert("File was last modified on - "+ xmlhttp.getResponseHeader("Last-Modified")) } } xmlhttp.send(null)Seems like it's time to start learning Ajax now...
  4. Hi all,I am trying to do a simple javascript that traverses an array of filenames (local) and looks up their last modified date. I figured I could do this by loading each file to a hidden frame, waiting until the page has loaded (using setTimeout, couldn't get addeventlistener for 'load' to work on the hidden frame) and then getting document.lastModified. This works fine for most files, but files that launch an external application cause the script to stop.So I am wondering the following:1. Is there a way to only get the head of a file (containing lastModified) but not the contents?2. Is there a way to suppress the launching of associated applications for filetypes (.doc, .xls etc)?3. Is there any other way to get last modified date for a bunch of files with javascript?Would appreciate any help, thanks!
×
×
  • Create New...