View Single Post
Old 10-08-2012, 01:03 AM   PM User | #12
patryk
Regular Coder

 
patryk's Avatar
 
Join Date: Oct 2012
Location: /dev/couch
Posts: 395
Thanks: 2
Thanked 64 Times in 64 Posts
patryk is on a distinguished road
How about passing arguments in url instead of storing them in txt file?
I would imagine it's even simpler to create shortcuts/bookmarks than creating txt files

if you have your frameset like that:
Code:
<frameset rows="98,*" frameborder="no" border="0" framespacing="0">
  <frame src="PageA.html" scrolling="No" noresize="noresize" id="topFrame"  />
  <frame src="" id="mainFrame"  />
</frameset>
then all you need to do is putting little javascript in your document:
Code:
<script language="javascript">
function getValue(name){
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	if( results == null ){
		return '';
	}else{
		return results[1];
	}
}
function updateSRC(){
	document.getElementById('mainFrame').src = getValue('theURL');
}
</script>
then you change <body> to <body onload="updateSRC()">

and call your document like that:
Code:
http://somedomain.com/document.http?theURL=http://something.com/blah.html
whatever you put after 'theURL' in address bar will be used as src of your frame
...that will work for you assuming i understood purpose of your question....

and btw text file aproach won't fly since modern browsers work in sandboxes limiting access to local file system
patryk is offline   Reply With Quote