Closed Bug 154604 Opened 23 years ago Closed 22 years ago

load local page using Javascript and hyperlinks to local pages don't work

Categories

(Core :: Security, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: sudheer, Assigned: security-bugs)

Details

I do not like to type/select frequently accessed links in the address bar or from the bookmarks menu. So I have created a html page and set it as my home page. The page contains some links to some sites and a FORM with the following elements 1) text box - In which I will type the URL to be loaded 2) FileChooser - To select local files from my disk. 3) A Button named 'Go' - Its 'OnClick' event will invoke a javascript which inturn will a) Load the file selected using FileChooser object (if any) OR b) Load the URL if the text box if it is not null The script uses the location.href property to load the appropriate pages. Suppose there is a page named 'index.html' in my 'c:\temp' folder, and there is a hyper link (say 'PAGE2') to another file (say index2.html) in the same folder. If I am loading the first file using 'Open File' menu item and click on the link PAGE2 it will load no problem. But if I am loading the page using my 'Home page', i.e., if I am selecting the file using the file chooser object and clicks on the Go button, then also the initial page will load but thereafter if I click on a link on the same page, it won't load. The same script had been working fine under IE and Netscape 4.7 My OS is Windows 2000 with 128 MB RAM and Mozilla build ID is 2002053012.
Sudheer: can you provide more information about the script you use? do you see any error message in Tools->Web development->JavaScript console? P.S. if your homepage is hosted on remote server, it should not work because mozilla will not allow loading local content from remote sites.
Alan, I am attaching a sample html file below. I am loading the page from my local disk. When I opened the Javascript console after loading my home page, I have seen the following error. Error: popup has no properties Source File: chrome://messenger/content/mailNavigatorOverlay.xul Line: 110 Regards Sudheer. <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Home Page</title> <script language="JavaScript"> <!-- function Browse() { if(document.Form1.file1.value.length==0) { location.href=document.Form1.URL.value; } else { var vLocation; vLocation = "file:///" + document.Form1.file1.value; location.href=vLocation; } } // --> </script> </head> <body text="#0000FF" bgcolor="#FFFFFF" link="#0690CC" vlink="#008080" bgproperties="fixed"> <form name="Form1"> <center><table BORDER=0 WIDTH="50%" > <tr> <td ALIGN=LEFT><input size="40" name="URL" value="http://www." id="URL" ></td> <td ALIGN=RIGHT><input type="button" name="Go" value="Go" onclick="Browse()" ></td> </tr> <tr> <td ALIGN=LEFT><input type="file" name="file1"></td> <td ALIGN=RIGHT><input type="reset" name="B1" value="Clear"></td> </tr> </table></center> </form> </body> </html>
Summary: Browser + Javascript Bug??? → load local page using Javascript and hyperlinks to local pages don't work
we don't allow access to file: from http:, is that what you're trying to do?
Assignee: Matti → mstoltz
Component: Browser-General → Security: General
QA Contact: imajes-qa → bsharma
Whiteboard: DUPEME
This is by design; it's a security feature though I know it's annoying at times. To turn it off, quit Mozilla and add the following line to your prefs.js file (in your user profile directory): user_pref("security.checkloaduri", false);
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → WONTFIX
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.