External link to iFrame - How to!

Trying to create a text link from an external webpage to target a certain page in the iframe? Here is how you do it.

NOTE: Please bare with me I’m writing this for people who don’t necessarilly understand code.

Note: We are using these filenames:
index.html = the file with the iframe
default.html = the file that the index.html file loads in the iframe if nothing else is specified,
finalcontent.html = the file you want to be loaded in the iframe of the index file (not the default file)
textlinkfile = the text link that will link to the index file and the targeted finalcontent.html file for the iframe
bob = the name I gave to the iframe.(I like to use something original so I can find it in the code later when I need to make changes)

Put this javascript code in your index.html file:

<script language=javascript>function loadsource()
var defaultPage = “default.html (Enter the filename you want as your default here)”;
var query = window.location.search.substring(1);
var pos = query.indexOf(’=’);
if (pos > 0)
var frameSource = query.substring(pos+1);
window.frames[“bob”].location = frameSource;
window.frames[“bob”].location = defaultPage;

Enter this into the body tag:
<body onLoad=“loadsource()”>
(For non-tech people, make sure there is only one body tag and enter just this part: onLoad=“loadsource()”)

Now on the external textlinkfile add this to the text link:
<a href=“index.html?fs=finalcontent.html”>Recipe</a>
Make sure you include the entire path. So if your file is in a folder include that: example - <a href=“index.html?fs=folder/finalcontent.html”>Recipe</a>

Test it. It should work!!!

Let me know if this has helped you!