5
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by itsjareds
0

Try the following format in your links':

<a target="iframeName" href="iframePage.html/#iframeName/yourDemoPage.html">DEMO</a>
0

Hi, i already did try that and that's what make it load in a new window, i then tried _self but only difference is it it just opens in current window but not in iframe.

I have been reading that Javascript can acheive this but not sure how i would do it meaning i need to add it to a link.

thank you,
genieuk

0

I am managed to solve it using an if statement so basically it checks a variable if that variable is nto equal to a specific url it wont show links.

It works a treat.

Now i need to force the iframe pages to only be allowed to show in iframe and not by directly going to url.

thank you,
genieuk

0
<a href="" onclick='document.getElementByID("iframeID").src="href";'>demo</a>
<iframe frameborder='0' src='blank.html' id='iframeID'>iframe</iframe>
0

To add on to almostbob's post, this is what worked for me (Firefox v3.0.10):

<a href="http://www.w3.org/" target="iframeID">Redirect frame to W3.org</a><br/>
<iframe frameborder="0" src="http://www.daniweb.com/" name="iframeID" style="width:100%; height:90%;">iframe</iframe>

As for making sure the pages can only be viewed in a frame, try adding this JavaScript to all your frame pages:

if (window == window.top)
	window.location.href = "example.php?showFrame=frameContent.html";

My advice is to make your parent frame a PHP frame, and add a GET variable that, if present, will show this HTML page instead. Example:

<?php
if ($_GET['showFrame'])
	$frameURL = $_GET['showFrame'];
else
	$frameURL = "homepage.html";
?>
<iframe src="<?php echo $frameURL ?>" name="myFrame"/>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.