If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[RESOLVED] IE8 documentElement is null for local files

My files are not hosted on a server using http. They come with many sound files to practice vocabulary. The problem is that IE8 does not give me the opportunity to load xml course info, I suspect it is because Microsoft might think IE is for network use only (funny they don't think that when MS Word is concerned). Everything works fine in opera and firefox but IE does not give me a documentElemet after loading the xml. Here is some code to reproduce:

What is the responseText:::::::-<?xml version="1.0" encoding="utf-8"?>
<lesson>
<info> some info</info>
</lesson>
-::::::::
What is the responseXML.documentElement::::::--::::::::
Is the responseXML.documentElement null::::::-true-::::::::
Is the responseXML.firstChild null::::::-true-::::::::

IE blocks by default ActiveX and javascript when running local files. It will show you a small "banner" upside with a message: "To help protect your security IE has restricted this webpage from running scripts or ActiveX controls..." You must click that banner and chose to allow the code. You may bypass that by modifying the Security level in Options, but it is nor recommended, as it will open a security hole - IE is quite vulnerable

Ok, I see the security risk in letting local files use xmlhttprequest or have an iframe (I tried that too) load the xml after which the containing window will read it.
If a file is local you can open up any file from the disk and post it to some website, maybe even open one of windows help files and abuse active x controls on them to gain write permission to the system.

What I don't understand is why I cannot find anything that will allow me to "trust" a local page. IE just disables it altogether and other browsers don't seem to be worried about security risks involved (but they might disable it in the future). It would be better if they would let the user set up some sort of trust for locally run files.

Ah well, back to flex. I guess MS, Mac ad opera's bashing of it was not hindered by any knowledge of how quirky html(5) really is (the main success of flash in the first place)

What I don't understand is why I cannot find anything that will allow me to "trust" a local page. IE just disables it altogether and other browsers don't seem to be worried about security risks involved (but they might disable it in the future).

IE blocks by default ActiveX and javascript when running local files. It will show you a small "banner" upside with a message: "To help protect your security IE has restricted this webpage from running scripts or ActiveX controls..." You must click that banner and chose to allow the code. You may bypass that by modifying the Security level in Options, but it is nor recommended, as it will open a security hole - IE is quite vulnerable

Nope, not clicking on the banner would result in me staring at the empty textarea until something would happen, it never will because none of the script will be executed until you click the banner and allow it to.

Thanks for your reply anyway, I guess this project will go in the bin until browser developers start seeing the benefit in running local files. My idea was to let the browser be my JVM, html be my swing and JavaScript be my JAVA. Program it one time and have it run on most every machine with a browser supporting the script (that would include many smart phones as well). But since this needs to run locally as an application (there are lots of external resources like sound and video) it will be impossible to do in html(5). I'll have a look at adobe air but it's not as widely supported as html/JavaScript.

I have made a simple course in flash, it plays sound and shows texts then you can evaluate if it was correct or not. It uses general objects as question steps so it can be re-used to practice calculus, geography for kids or language study for adults. Its sort of a flashcard app but with video and sound (if supported by browser) and will have several question evaluation classes (like self evaluation "I was wrong/right", fill in number, date, text, multiple choice)

Before spending more time programming more classes for the course app I want to check what platform would be best to release it on. HTML 5 seemed to me the best choice since it is available for mobile phones, windows, mac and linux. Java or flash are less desired options since it requires the user to install and configure extra software.

Especially mobile phones would be nice since you can practice your vocab while commuting or waiting for something.

Here come the trouble though, opera mobile not yet supports audio tag. It might support Audio object but doesn't play anything and it will not support the html5 local storage for local files. It doesn't even allow cookies from local files. So when audio will be supported saving state is still not possible. IE has been a disaster, where I have minimal functionality working in firefox and opera IE just does it's utter best not to make it work.

But for all the small problems that the browsers will have, at least it is available with limited but soon to be expanded functionality where I am afraid with the recent bashing against flash that this might be less and less supported. Android will have/has a good html5 browser, I think iphone has good support, opera mobile can be used for windows phones (without sound or saving state) and firefox for any desk/laptop.

HTML 5 seemed to me the best choice since it is available for mobile phones, windows, mac and linux.

No. You confound the Operating Systems with the browsers. OS has nothing to do with HTML. The way HTML, CSS, and Javascript are interpreted is a privilege of the browser. On the same OS, say Windows, FireFox may interpret some HTML, CSS or JavaScript otherwise than IE8, and IE8 otherwise than IE7 or IE6, or Chrome, or Opera...

Smartphones use different browsers as well. Some use a variant of Safari browser (iPhone), others various browsers based on WebKit engine (on Android or on the new Symbian equipped Nokia phones, for instance), and so on.

Sound and video would be cool but showing images and text will do for now. I am sure that is what most browsers on most devices can do.

I'm just hoping that most browsers will go in the (same)direction of html5 but whatever will happen for a simple flashcard app I think a browser that runs the script would be better than flash or java since every device/os has one.

Minimal requirement is loading the xml with step data (like 1. show text, 2. wait, 3. show text (the answer).
question data: (what text to show in step 1 and id of the element, how long to wait in step 2, what text to show in step 3 and id of the element.
Question evaluation type: like self eval, number, date, text, multiple choice.
This would separate the code from the data. Someone making a course only needs to design the html and create the xml. A text step will contain the id of the element to put the text in. A sound step would need the relative path and name of the file to (try to) play and so on.

If we drop the sound and video for now I am sure you'd agree that using a browser to host the application would be best. Even with all the quirkiness it will be the most available one.

If we drop the sound and video for now I am sure you'd agree that using a browser to host the application would be best. Even with all the quirkiness it will be the most available one.

Agree. Except that I see no wiliness from browsers' vendors (especially IE) to implement HTML 5 and CSS3 in their products in the near future. Or if something is not accessible on about 60% of the market (IE), that something is not to be used yet. We must code for the majority, unfortunately, not for the top equipped users...

Yes, I should implement IE as well but it will take a lot more time (it's just not as much fun as scripting in Firefox with firebug).

I am doing this for fun, haven't programmed anything professionally for 3 years and now trying to make courses for Chinese that want to learn English. Will try to make vocabulary practice and reciting text stuff with self evaluating answer classes.

My real concern is that other browsers might implement the no xmlhttprequest.documentElement and no access to iframe content for local files. It would break the the most importaint requerement of the application.

Now thinking of supplying the course data through a js file. It would be more robust.

This got me a bit frustrated since the IE debugger shows firstChild and stuff but cannot access it with script. No exception is thrown as well (a "not allowed from file:// protocol or something would be nice").

Not sure how widely supported java is. For me it's no trouble to install a jvm on a desk/lapt but mobile devices might be a different story.

A Java program/midlet will not allow designers to change the look to whatever they want. In html all you need is some elements that support innerHTML (Nice and flexible and in my oppinion a good thing) to show the text. Some image elements to set src for.

I am just hoping that html5 will get enough momentum for browser manufacturers to start implementing it. Even some parts of it like sound would already make a huge difference.

Not sure how widely supported java is. For me it's no trouble to install a jvm on a desk/lapt but mobile devices might be a different story.

A Java program/midlet will not allow designers to change the look to whatever they want. In html all you need is some elements that support innerHTML (Nice and flexible and in my oppinion a good thing) to show the text. Some image elements to set src for.

I am just hoping that html5 will get enough momentum for browser manufacturers to start implementing it. Even some parts of it like sound would already make a huge difference.