This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to check a file is existing in window.location Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to check a file is existing in window.location" Watch "How to check a file is existing in window.location" New topic
Author

How to check a file is existing in window.location

sumanth kumar
Greenhorn

Joined: Jul 29, 2005
Posts: 22
I've a request that when user hit a url ("https://host:port/IDSearch.html"), first we need to search another file in that location (Where IDSearch.html) is available. If that file is available we need to load that file instead of IDSearch.html. how can we do that? Can we do this in javascript code in IDSearch.html? please advice.
Or any alternate way to check the file and load?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You need to see if the file exists on the server? Make a head Ajax call with the XMLHttpRequest object to that url.

Eric
 
Consider Paul's rocket mass heater.
 
subject: How to check a file is existing in window.location
 
Similar Threads
Display jpeg file in jsp page
how to design this JSP. need ur suggestion
Use different XSL files on the same XML doc
Including .js files into certain pages
call action with javascript