I was under the illusion that I could load an HTML fragment, but I am
getting a security error, specifically:
SECURITY_ERR: DOM Exception 18
When I try to find info on this error, I found a reference in the
HTML5 draft to the sandboxed origin browsing context flag
(http://www.whatwg.org/specs/web-apps/current-work/
), which implies that I might not be able to get away with loading
page fragments. The problem is that what I am trying to do is WAY too
large to fit into a single HTML file, a la Dashcode.
So, advice please. Here's my code - is there a way to make this work?
function loadPage(pageToLoad, target) {
try {
var req = new XMLHttpRequest();
} catch (e) {
alert("XMLHttpRequest not supported!");
}
req.onreadystatechange = function(pageToLoad, target) {
if (req.readyState == 4) { // only if req is "loaded"
if (req.status == 200) { // only if "OK"
document.getElementById(target).innerHTML =
req.responseText;
} else {
alert("Error: "+ req.status + " " +
req.statusText;
}
};
try {
req.open("GET", pageToLoad, true);
} catch (e) {
alert("Error: " + e.message);
}
document.getElementById(target).innerHTML = req.responseText;
req.send(null);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---