Reputation: 13
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.
Upvotes: 0
Views: 2053
Reputation: 230
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");
}
Upvotes: 2
Reputation: 270
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.
Upvotes: 0