Attempting to create an HTML/JS application that will run on desktop. The only complication is the requirement to read (but not write) a text file. I have attempted to do this by acquiring the file within an iframe and then recovering the contents from there. However, Chrome merely logs a message "Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame."
Had expected that within the same folder in a desktop environment the same "domain" would persist.
The actual application is based on the 'prototype' framework, so want to avoid any further framework if poss.
Any ideas?
HTML:
<html>
<head>
<script type="text/javascript">
function myFunc(){
alert(document.getElementById( 'frame' ).contentWindow.document.body.innerText);
}
</script>
</head>
<body>
<div id="list">
<p>
<iframe src="x.txt" id="frame" width="50" height="50" onload="myFunc()"></iframe>
</p>
</div>
</body>
</html>
The file x.txt contains the characters "XYZ" and sits in the same PC folder as the html file.