Vel Straty Posted July 22, 2005 Share Posted July 22, 2005 Is there a way to check if an html document exists?I know that it can be done for a IMG tag with an onerror way and I tried to do it with an IFRAME tag with a onerror way but didin't work out.Maybe a simple dos batch command of IF EXIST something like that would be nice but the script is only for client-side and thus needs to use only javascript and phps. Link to comment Share on other sites More sharing options...
agraddy Posted July 22, 2005 Share Posted July 22, 2005 Why not use the PHP is_file('my_page.html') function?You can find more information at PHP.net__________________My Company: SetigoMy Work In Progress: Stillwater Oklahoma Rental Link to comment Share on other sites More sharing options...
Stalkie Posted July 24, 2005 Share Posted July 24, 2005 I would have suggested file_exists, but since it's only for files, the is_file should suffice. Link to comment Share on other sites More sharing options...
Vel Straty Posted July 26, 2005 Author Share Posted July 26, 2005 var xmlhttp;function loadXMLDoc(url) { /* Mozilla */ if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange=state_Change xmlhttp.open("HEAD",url,true); xmlhttp.send(null); } else /* IE */ if (window.ActiveXObject) { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); if (xmlhttp) { xmlhttp.onreadystatechange=state_Change xmlhttp.open("HEAD",url,true); xmlhttp.send(); } }}function state_Change() {// if xmlhttp shows "loaded" if (xmlhttp.readyState==4) { if (xmlhttp.status==200) { document.location.href="toc.html"; // document.getElementById('T1').innerHTML=xmlhttp.getAllResponseHeaders() } else { // document.location.href="toc.html"; } }}loadXMLDoc('toc.html');Thanx for suggestions ppl!But I found out the way by using javascript XML or whatever its called when I searched for many hours! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now