StringBuilder html = new StringBuilder();
string jqueryPath = System.IO.Path.Combine(appPath, "jquery-1.7.2.js");
Pretty standard stuff, right? Well, actually, no.
When I navigated to my html stream, I received the error "invalid character at line 1 character 1". If I saved the stream to a HTML file, and loaded it in IE (v9), it worked fine (no error).
The problem is related to security for locally loaded files (if you want to google it, be my guest), and there are three fixes available (that I could find):
- Add "about:blank" to your Trusted Sites in IE (we couldn't do this because it added one more moving part to the deployment process of the app, and probably compromises security in some as-yet-to-be-determined manner.
- Create a blank HTML file, load it, and modify the DOM by inserting script elements programatically . We didn't want to do this because there was a possibility we'd forget to add something, and this code also has to eventually be cross-platform.
- Just bite the bullet and add the script file content as text in the string. This meant we'd have to load the file ourselves, and insert it into the
We chose the third option. It was the easiest and posed the fewest possible problems. Your mileage may vary.