View Full Version : checkBrowser function alerts"cannot find file.."
axcxe
12-09-2002, 07:34 PM
Hi, I am trying to use this function to open a html file based on the browser being used. This code is in the ufodom html file.(the ufodom file for ie6/netscape7 and ufonav for netscape 4.6) The url's are correct but a message appears saying "cannot find file specified" in both netscape7 and 4.6 and ie.
my function looks like this:
function checkBrowser(){
if (document.getElementById) {
document.location.href = "ufodom.html";
}
else if (document.layers) {
document.location.href = "ufonav.html";
}
}
Thanks for your help...
joh6nn
12-09-2002, 08:00 PM
well, first off, document.location, is wrong; it works, but as best i can tell, it's a bug. it's really supposed to be window.location. that's not your problem, but i just thought i'd point it out.
i think your problem, is that you're only assigning the file name, and not the full path of the file. in theory, that should work fine, but i've always had problems doing it that way. whenever i us the full file path, though, it works just fine. so try:
function checkBrowser(){
if (document.getElementById) {
window.location = "http://www.yoursite.com/ufodom.html";
}
else if (document.layers) {
window.location = "http://www.yoursite.com/ufonav.html";
}
}
hope that helps.
axcxe
12-09-2002, 08:21 PM
That seems to work in netscape 7/ie. Only problem is this file is on a zip disk, not uploaded so in netscape 4.6 it says h: is an illegall url method. thanks for your help.
ahosang
12-09-2002, 09:40 PM
put the proper protocol before the path:
file:///
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.