1

I have web page which has 2 horizontal <frame>s. The 2nd <frameset> is divided in to a 2 column <frameset>.

Now when I click on an external link of 1st <frame> it should load the page into the 2nd column's <frame>.

I have named both frames and on the href I have added the destination.

See example pages:

index.html

<!DOCTYPE html>
<html>
<frameset rows="25%,*">
  <frame src="title.html">
  <frame src="frames.html">
</frameset>
</html>

title.html

<!DOCTYPE html>
<html>
<marquee>
<b>
Welcome
</b>
</marquee>
</html>

frames.html

<!DOCTYPE html>
<html>
<frameset cols="15%,*">
  <frame src="menu.html" name="menu_page">
  <frame  name="main_page">
</frameset>
</html>

menu.html

<!DOCTYPE html>
<html>
<a href="http://www.google.com" target="main_page">Google</a>
<br /><br />
<a href="http://www.microsoft.com" target="main_page">Microsoft</a>
<br /><br />
</html>
andyb
  • 43,435
  • 12
  • 121
  • 150
Mr x
  • 828
  • 1
  • 8
  • 25

1 Answers1

0

It's a security feature of modern web servers and browsers. If you look in the browser's console log you might see something like:

Refused to display 'https://www.google.co.uk/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

Google has purposely set the X-Frame-Options response header which indicates

whether or not a browser should be allowed to render a page in a <frame>, <iframe> or <object>. Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites.

The browser is stopping your page embedding another site. There are workarounds but it is considered bad practice to not respect the site author's wishes - see Overcoming "Display forbidden by X-Frame-Options".

Community
  • 1
  • 1
andyb
  • 43,435
  • 12
  • 121
  • 150