0

I want to show an external site in an iframe. But I'm getting this error: "This content is not displayed in a frame".

 <div id="frameDiv" style="height: 900px;">
<iframe id="leftFrame" src="<%=leftLink%>" width="100%" height="100%" name="leftFrame"></iframe>
 </div>

I also use it as a meta tag:

<meta http-equiv="X-Frame-Options" content="SAMEORIGIN" />

Thanks.

asked Jan 4, 2017 at 11:46
4
  • There is an IE security setting, since you are loading external websites IE might stop this. Tools --> Internet Options --> security --> Internet Zone --> Custom Level --> Miscellaneous --> Launch programs and files in an iframe. with other browser Read the warning text - The publisher (google) does not permit hosting their site in an iframe or frame. Google does this by adding a http header, "X-FRAME-OPTIONS: DENY" which modern browsers will - and should - obey. developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header Commented Jan 4, 2017 at 11:54
  • So I can not use an iframe in Chrome? Commented Jan 4, 2017 at 11:58
  • The site you are displaying in the iFrame, is it a site you own, or something out in public domain? Commented Jan 4, 2017 at 12:59
  • It is a site used internally but in another domain. Commented Jan 4, 2017 at 13:02

2 Answers 2

2

try this

<iframe name="myIframe" id="myIframe" width="400px" height="400px" runat =server></iframe>

Expose this iframe in the master page's codebehind:

public HtmlControl iframe
{
get
{
return this.myIframe;
}
}

Add the MasterType directive for the content page to strongly typed Master Page.

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits=_Default" Title="Untitled Page" %>
<%@ MasterType VirtualPath="~/MasterPage.master" %>

In code behind

protected void Page_Load(object sender, EventArgs e)
{
this.Master.iframe.Attributes.Add("src", "some.aspx");
}
answered Jan 4, 2017 at 12:00
Sign up to request clarification or add additional context in comments.

1 Comment

Actually what error are you getting can paste the screen shot or some reference
0

I've tried this solution and its useful in my problem:

  • Open Internet Explorer and select "Tools> Internet options".

    Select the "Privacy " tab and select the "Advanced" button.

    An "Advanced Privacy Settings" window will open.

    Tick the "Override automatic cookie handling" button and "OK" back to Internet Explorer.

Now try your problem website.

answered Jan 4, 2017 at 11:54

1 Comment

Do not have a solution with code? Users need to work on all browsers without having to make this setting.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.