PDA

View Full Version : Ext.Net Window problem with loading external website into content frame



Guest
May 19, 2016, 10:16 AM
Hello to all,

I'm using Ext.Net 4 and C# Code-Behind in ascx.cs-Files. Working with Visual Studio 12 and .Net-Framework 4.5.

I want to load an external Website into a window as Content. When I load the site "http://ext.net" it works. But when I want to load the site "http://web.de" it doesn' t work, because the site can't be load into a Frame: "This content can not be displayed within a frame". How can I solve the Problem?

My ext.net ascx-File:


<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="XXXXX.ascx.cs" Inherits="XXXXXXX" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<ext:Window
ID="TestWindow"
Title="Test"
Height="750" Width="750"
Modal="true" AutoRender="false"
Collapsible="true" Maximizable="true" Hidden="true"
runat="server">
<Loader ID="LoaderViewDocument"
runat="server"
AutoLoad="false"
Url="http://web.de"
Mode="Frame">
<LoadMask ShowMask="true" />
</Loader>
</ext:Window>



And my code behind ascx.cs file:


[DirectMethod]
public void DoLoadWindow()
{
this.TestWindow.Hidden = false;
this.TestWindow.LoadContent();
this.TestWindow.Show();
}

Trying it too with loader params in ascx:

TriggerEvent="show"
ReloadOnEvent="true"
DisableCaching="true"

Even when I set the Url-Parameter in code behind instead in ext.net directly:

this.TestWindow.LoadContent(url);
it doesn' t work with some Url's.
With http://ext.net or http://www.cnn.com there is no Problem.

Thank you for your answers!

Best regards

fabricio.murta
May 19, 2016, 5:13 PM
Hello Guest, and welcome to Ext.NET forums!

This seems not to be a problem related to Ext.NET, but with the website not allowing itself to be loaded into a frame.

It really looks like the problem described in this stackoverflow discussion: IFrame: This content cannot be displayed in a frame (http://stackoverflow.com/questions/14141388)

I hope this helps!

EDIT: Check out this simple HTML code:



<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
Let's see whether the IFrame works for Ext.NET:<br />
<iframe src="http://ext.net" width="100%" height="200"></iframe><br /><br />
Now for web.de:<br />
<iframe src="http://web.de" width="100%" height="200"></iframe>
</body>
</html>


This indicates as something the target website disallowed and browsers obey, something beyond Ext.NET's scope.

EDIT2: The website http://web.de/ explicitly forbids to be displayed in frames by its HTTP headers:



HTTP/1.1 200 OK
Date: Thu, 19 May 2016 17:23:29 GMT
Server: Apache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache
Cache-Control: no-cache, no-store
X-Frame-Options: deny
Content-Type: text/html;charset=UTF-8
Set-Cookie: ui_cid=7UEuAYfC4MKDBo21CmO7; Expires=Wed, 17-Aug-2016 17:23:29 GMT; Path=/
Set-Cookie: um_cvt=UzHGLQpIBTMAABjAgjcAAAGX;domain=web.de;Http Only
Set-Cookie: SSLB=.0; domain=web.de ;path=/
Vary: Accept-Encoding


Line 7 is the header denying browsers to display it on iframes.

Guest
May 20, 2016, 9:04 AM
Hello Fabricio!

Thank you for your answer. It's just what I thought. But I thought maybe there's a Workaround...

When I open it in a new tab it works. I just tried it with JavaScript "window.open". But then I have problems with popup-blocker.
So I want to open an external Website in a new browser window. How can I do it in Ext.Net?

Many thanks for an answer.

Best regards