Hi,
I've run into a problem using standard server side code injecting javascript into a label to close a radwindow. The code works fine in IE and FF.
ASPX
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz az well)
return oWindow;
}
function CloseWindow() {
GetRadWindow().Close();
}
<body style="background-color: #EDF3FE; font-family: Arial; font-size: 12px; color: Navy;
padding: 0px; margin: 4px; overflow: hidden">
<form id="form1" runat="server">
<asp:Label ID="lblJS" runat="server"></asp:Label>
etc...
aspx.cs
protected void cmdCancel_Click(object sender, EventArgs e)
{
lblJS.Text = "<script language='javascript'>CloseWindow()</script>";
}
When I execute the button click Chrome just displays "Aw Snap!"
Looking at Chrome's error console I see:
Failed To Load Resource http://localhost:50163/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a3bbfe379-348b-450d-86a7-bb22e53c1978%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.2.826.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a86f56c91-febb-4172-ae71-6c2ba2372421%3a16e4e7cd%3aed16cbdc%3af7645509%3a24ee1bba%3a1e771326%3aaa288e2d%3a8674cba1%3ab7778d6c%3ac08e9f8a%3aa51ee93e%3a59462f1
Any idea what's going on please?
Regards
Alan
12 Answers, 1 is accepted

I've exactly the same issue here ..
Version of chrome : 6.0.472.62
Version of Telerik : 2010 Q2 SP1
There's no way to close a radwindow, even from closing all windows from the manager using the .CloseAll();
Does anyone know a quick fix ? it's very urgent on my side ..
Thanks guys,
D.

I just upgraded to the 2010 Q2 SP1 (verson 2010.2.826) yesterday. Since upgrading, anytime we attempt to close a window via javascript...Chrome throws the Aw Snap! error page...
Can you please send a sample project that reproduces this problem? I tried to reproduce it locally but everything is working as expected. What I can suggest at this point (based on the code excerpt from Alan) is
1. Not to use a Label for outputting the JavaScript, but ScriptManager's RegisterStartupScript.
2. Try to call (in the JS function) GetRadWindow().close() with a small timeout.
I hope this helps.
Sincerely yours,
Georgi Tunev
the Telerik team

When 'DestroyOnClose=true' the AwSnap message appears right away, when false the Aw Snap message appears when navigating away from the page.
Doesn't seem to be an issue w/ Chrome on OSX.
The following code causes the issue as long as there is a 'sample.pdf' available:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<%--Needed for JavaScript IntelliSense in VS2010--%>
<%--For VS2008 replace RadScriptManager with ScriptManager--%>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
//Put your JavaScript code here.
function buttonClicked() {
radopen(null, "rwView");
}
</
script
>
<
input
id
=
"button"
type
=
"button"
value
=
"Click Me!"
onclick
=
"buttonClicked();"
/>
<
telerik:RadWindowManager
ID
=
"radWindowManager"
runat
=
"server"
VisibleStatusbar
=
"False"
Behaviors
=
"Close, Move, Resize,Maximize"
DestroyOnClose
=
"true"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"rwView"
Width
=
"600px"
Height
=
"600px"
runat
=
"server"
NavigateUrl
=
"sample.pdf"
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
<
div
>
</
div
>
</
form
>
</
body
>
</
html
>
Another customer of ours just sent a sample project that reproduces the problem with the JavaScript outputted from the server. Again DestroyOnClose was set to true in that project. In such case you need to make sure that the script will be executed only when the content page is completely loaded.
e.g.
function
CloseWindow()
{
Sys.Application.add_load(
function
()
{
var
rWindow = GetRadWindow();
rWindow.close();
});
}
Mike, unfortunately at this point I cannot provide a solution for your scenario. I was able to reproduce the problem and I logged it in our database (and updated your points). We will examine it and do our best to provide a solution as soon as possible.
Sincerely yours,
Georgi Tunev
the Telerik team

Add a OnClientBeforeClose handler and wrap an explicit call to radWindow.close() in a try catch block, stuffing any exceptions.
In Chrome the window will flash black before closing as the method seems to be called more than once - but will eliminate the Aw Snap message. Other browsers seem to close normally. Problem is after repeated openings and closings - eventually the crash returns.
<
script
type
=
"text/javascript"
>
//Put your JavaScript code here.
function buttonClicked() {
radopen(null, "rwView");
}
function CloseWindow(sender, args) {
try {
sender.close();
} catch (err) {
//alert("Caught Exception: " + err.description);
return 0;
}
// sender = null;
}
</
script
>
<
input
id
=
"button"
type
=
"button"
value
=
"Click Me!"
onclick
=
"buttonClicked();"
/>
<
telerik:RadWindowManager
ID
=
"radWindowManager"
runat
=
"server"
VisibleStatusbar
=
"False"
Behaviors
=
"Close, Move, Resize,Maximize"
DestroyOnClose
=
"true"
OnClientBeforeClose
=
"CloseWindow"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"rwView"
Width
=
"600px"
Height
=
"600px"
runat
=
"server"
NavigateUrl
=
"sample.pdf"
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>

Hi Again,
Have been tied up with something else for a couple of days but I can confirm that this problem didn't exist before upgrading to the latest build last week.
Have tested on windows 7 with an older version of chrome and vista sp1 with the latest version of chrome and the problem occurs with with vs2008's Cassini server and also on our remote test server running IIS 7.5
If you need any more specific information, please let me know.
Regards
Alan
I just wanted to notify you that we found the reason for the problem - it comes from the new feature in Chrome which provides additional security:
http://blog.chromium.org/2010/05/security-in-depth-html5s-sandbox.html
This new feature interferes with the way we dispose the RadWindow and we are currently investigating the possible fixes. I will write back once we have more information.
Best wishes,
Georgi Tunev
the Telerik team

There are several solutions to this problem that we currently evaluate - we want to make sure that the new logic will not cause problems in various scenarios. The fix should be present in the Q3 BETA that we will release next week.
Regards,
Georgi Tunev
the Telerik team

