Can JavaScript list files at a domain that it is permitted to see?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tur130
    New Member
    • Jul 2010
    • 16

    Can JavaScript list files at a domain that it is permitted to see?

    I have a whole bunch of files called xxx_Page1.htm at a domain, where xxx is a type of animal. I have a script that iterates through a known list of animals setting MyVar for each one. The following line works just fine at bringing these files on to a web page inside MyDiv:

    document.getEle mentById('MyDiv ').innerHTML = "<iframe src='"+MyVar+"_ Page1.htm'></iframe>";

    However the the files at the server are being added to all the time. I can maintain the list of animals to make it work, but my question is can JavaScript return me a list of files it is allowed to see at a given domain?

    e.g. can I get ./*_Page1.htm returned where * is a wildcard and ./ is the domain.

    p.s. I'm not allowed to write any server side code in this case :(
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    no ... javascript has no access to a filesystem ... you could make an ajax call to a serverside script (php or whatever) that returns you the list of available files ...

    Comment

    • tur130
      New Member
      • Jul 2010
      • 16

      #3
      Can you help me understand this...



      Follow the link for 'Head' to...



      Look at the description of options, it says...

      "OPTIONS
      Returns the HTTP methods that the server supports for specified URL. This can be used to check the functionality of a web server by requesting '*' instead of a specific resource."

      Assuming the server supports it - there appears to be a way - or am I reading this incorrectly ?

      Comment

      • JKing
        Recognized Expert Top Contributor
        • Jun 2007
        • 1206

        #4
        Options will return the methods a specified URL supports. This will return something like GET, HEAD, POST. Using the wildcard * instead of specifying a URL will return the methods the server supports instead of a specific URL. Also returning GET, HEAD, POST etc.

        Comment

        • tur130
          New Member
          • Jul 2010
          • 16

          #5
          D'oh!

          Thanks for answering.

          Comment

          Working...