Hello Bud,
The first line:
Code:
if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)=='index.html'){window.location.replace('index.html?home.html')}
Meaning:
If the part after the last '/' in the address bar simply is index.html, then replace index.html with index.html?home.html.
This is needed to put your starting page (which used to be home.html) in the iframe right from the start. (But your changed things, see below).
The second line:
Code:
if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)==''){window.location.replace('index.html?home.html')}
Meaning:
If there's nothing after the last '/' in the address bar, then do the same as above.
This too is needed to put your starting page (which used to be home.html) in the iframe right from the start. (But your changed things, see below)
The third line (there are only 3 lines!)
Code:
if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!='index.html' && document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!=''){$('#test').append('<iframe style="position:absolute; width:100%; height: 100%" frameborder="0" src="'+document.URL.substring(document.URL.indexOf('?')+1,document.URL.length)+'"></iframe>')}
The if-part is a repetition of the 2 first lines, just to be sure. The relevant part is (using jQuery):
Code:
{$('#test').append('<iframe style="position:absolute; width:100%; height: 100%" frameborder="0" src="'+document.URL.substring(document.URL.indexOf('?')+1,document.URL.length)+'"></iframe>')}
Meaning:
Append to the div having id="test" a full size iframe that loads a file corresponding to: document.URL.substring(document.URL.indexOf('?')+1,document.URL.length).
The string for this file represents what you put after '?' in the links, in your main file.
By the way there was a typo in the last line. I had forgotten to put the red '>' above.
Now, as to your second attempt: the reason why your http://www.web-user.info/arie/index2.html does not contain an iframed page right from the start is that your main page is called index2.html now (there's no index.html anymore). So in your code, you should replace all index.html with index2.html. Moreover, ?home.html does not make sense anymore, because in http://www.web-user.info/arie/index2.html there's no page called home.html. The part to the left of '?' should correspond with your main file (which is index2.html now), and the part after '?' should correspond with the name of a file you want to put in the iframe right from the start. It could be anything existing, like http://web-user.info/search/business.
So in your new code, replace each index.html with index2.html, and replace your script with this:
Code:
<script>
$(document).ready(function() {
if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)=='index2.html'){window.location.replace('index2.html?http://web-user.info/search/business')}
if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)==''){window.location.replace('index2.html?http://web-user.info/search/business')}
if(document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!='index2.html' && document.URL.substring(document.URL.lastIndexOf('/')+1,document.URL.length)!=''){$('#test').append('<iframe style="position:absolute; width:100%; height: 100%" frameborder="0" src="'+document.URL.substring(document.URL.indexOf('?')+1,document.URL.length)+'"></iframe>')}
});
</script>
That should do it (hope there aren't typos anymore).
Good luck,
Arie.
(It's not difficult, really; what is needed is just a little bit of perseverance).
Bookmarks