PDA

View Full Version : [CLOSED] Open External Website in Tab Error in IE with parentAutoLoadControl



rsnead
Mar 05, 2014, 11:11 PM
I've been having trouble in IE with opening a new tab with the loader, it appears to be working in Chrome. I am hoping you might have solution to this issue. The dynamic code is generating the following error:
Thanks for your assistance
Russ



Exception was thrown at line 2491, column 13 in http://localhost:53440/extnet/extnet-all-debug-js/ext.axd?v=14713
0x80070005 - JavaScript runtime error: Access is denied.
If there is a handler for this exception, the program may be safely continued.


And stopping on the following code block within the dynamic code:


beforeIFrameLoad: function () {
try {
this.target.iframe.dom.contentWindow.parentAutoLoa dControl = this.target;
} catch (e) { }
},



Test routine
Home Controller


public StoreResult GetTreeCategories(string node)
{
Node child = new Node();
child.Text = "sites";
child.Leaf = true;
child.NodeID = "sitesID";

NodeCollection nodes = new NodeCollection(false);
Node root = new Node();
root.Text = "Organization";
root.AllowDrag = false;
root.Expanded = true;
root.Children.Add(child);
nodes.Add(root);
return this.Store(nodes);
}

public ActionResult GetPasswordByOrgTreeKey(string orgTreeKey)
{
if (!string.IsNullOrEmpty(orgTreeKey))
{
pwdInformation info = new pwdInformation();
info.methodKey = 1;
info.method = "Website";
info.logonName = "";
info.logonPwd = "";
info.url = "http://www.ext.net/";
Store storePwd = this.GetCmp<Store>("storePassword");
storePwd.LoadRawData(info);
}
return this.Direct();
}


Index.cshtml


@(
X.Store()
.ID("storePassword")
.SyncUrl(Url.Action("StorePasswordSync", "Home"))
.Reader(r => r.Add(X.JsonReader()))
.Writer(w => w.Add(X.JsonWriter().Encode(true).Root("data")))
.AutoDataBind(true)
.ShowWarningOnFailure(false)
.Data(Model)
.Listeners(l => { l.Exception.Fn = "onStoreException"; })
.Model(
X.Model().Name("modelPassword").IDProperty("passwordKey")
.Fields(
new ModelField("passwordKey", ModelFieldType.Int) { Mapping = "passwordKey" },
new ModelField("orgTreeKey", ModelFieldType.Int) { Mapping = "orgTreeKey" },
new ModelField("userKey", ModelFieldType.Int) { Mapping = "userKey" },
new ModelField("categoryKey", ModelFieldType.Int) { Mapping = "categoryKey" },
new ModelField("logonName", ModelFieldType.String) { Mapping = "logonName" },
new ModelField("logonPwd", ModelFieldType.String) { Mapping = "logonPwd" },
new ModelField("url", ModelFieldType.String) { Mapping = "url" },
new ModelField("comments", ModelFieldType.String) { Mapping = "comments" },
new ModelField("methodKey", ModelFieldType.String) { Mapping = "methodKey" },
new ModelField("memberNo", ModelFieldType.String) { Mapping = "memberNo" },
new ModelField("emailUsed", ModelFieldType.String) { Mapping = "emailUsed" },
new ModelField("techsupport", ModelFieldType.String) { Mapping = "techsupport" },
new ModelField("productNo", ModelFieldType.String) { Mapping = "productNo" },
new ModelField("licenseNo", ModelFieldType.String) { Mapping = "licenseNo" },
new ModelField("user", ModelFieldType.String) { Mapping = "user" },
new ModelField("method", ModelFieldType.String) { Mapping = "method" },
new ModelField("category", ModelFieldType.String) { Mapping = "category" },
new ModelField("parentKey", ModelFieldType.String) { Mapping = "parentKey" },
new ModelField("passwordparent", ModelFieldType.String) { Mapping = "passwordParent" },
new ModelField("vpnname", ModelFieldType.String) { Mapping = "vpnName" }
)
)
)
@(
X.Viewport()
.Layout(LayoutType.Border)
.Items(
X.Panel()
.ID("panelNorth")
.Region(Region.North)
.Layout(LayoutType.HBox)
.Split(false)
.Height(50)
.BodyPadding(5)
.Collapsible(false)
.Items(

X.TreePanel()
.ID("treeOrganization")
.Title("Organization")
.Region(Region.West)
.MinWidth(100)
.MaxWidth(500)
.Width(350)
.BodyPadding(5)
.Split(true)
.Collapsible(true)
.TitleCollapse(true)
.UseArrows(true)
.RootVisible(false)
.SingleExpand(false)
.MultiSelect(false)
.Mode(TreePanelMode.Remote)
.RemoteEditUrl(Url.Action("OrgTreeEdit"))
.RemoteRemoveUrl(Url.Action("OrgTreeRemove"))
.RemoteAppendUrl(Url.Action("OrgTreeAppend"))
.RemoteInsertUrl(Url.Action("OrgTreeInsert"))
.RemoteMoveUrl(Url.Action("OrgTreeMove"))
.Editor(X.TextField())
.Plugins(X.CellEditing())
.View(X.TreeView().Plugins(X.TreeViewDragDrop().Al lowLeafDrop(true).ContainerScroll(true)))
.Tools(
X.Tool().Type(ToolType.Expand).ToolTip("Expand all").Handler("this.up('treepanel').expandAll();"),
X.Tool().Type(ToolType.Collapse).TooltipConfig(tt => { tt.Width = 70; tt.Text = "Collapse All"; }).Handler("this.up('treepanel').collapseAll();"),
X.Tool().Type(ToolType.Refresh).ToolTip("Refresh").Handler("refreshTree(#{treePatientPages});")
)
.TopBar(
X.Toolbar()
.ID("tbarTree")
.Items(
X.ToolbarTextItem().Text("Filter:"),
X.ToolbarSpacer(),
X.TriggerField()
.EnableKeyEvents(true)
.Triggers(X.FieldTrigger().Icon(TriggerIcon.Clear) )
.Listeners(l => { l.KeyUp.Fn = "filterTree"; l.KeyUp.Buffer = 250; l.TriggerClick.Fn = "clearFilter"; })
)
)
.Store(
X.TreeStore()
.Proxy(X.AjaxProxy().Url(Url.Action("GetTreeCategories")))
.Root(X.Node().NodeID("Root"))
)
.DirectEvents(de =>
{
de.ItemClick.Url = Url.Action("GetPasswordByOrgTreeKey", "Home");
de.ItemClick.ExtraParams.Add(new Parameter("orgTreeKey", "record.data.id", ParameterMode.Raw));
})
.Listeners(l =>
{
l.ItemContextMenu.Fn = "showMenu";
l.ItemContextMenu.StopEvent = true;
l.RemoteActionRefusal.Handler = "Ext.Msg.alert('Action refusal', e.message);";
l.ItemClick.Handler = "Ext.getCmp('formPassword').getForm().reset();";
}),

X.FormPanel()
.ID("formPassword")
.Title("Passwords")
.Region(Region.East)
.MinWidth(100)
.MaxWidth(600)
.Width(500)
.Collapsible(true)
.Split(true)
.Collapsed(false)
.Layout(LayoutType.Border)
.Items(
X.GridPanel()
.ID("infomationGrid")
.Title("Defined Passwords")
.Region(Region.Center)
.Collapsible(true)
.Split(true)
.StoreID("storePassword")
.ColumnModel(
X.Column().ID("methodColumn").Text("Method").DataIndex("method").Flex(1),
X.Column().ID("categoryColumn").Text("Category").DataIndex("category").Flex(1).Hidden(true),
X.Column().ID("parentColumn").Text("Parent").DataIndex("passwordparent").Flex(1).Hidden(true),
X.Column().ID("urlSiteColumn").Text("Url").DataIndex("url"),
X.CommandColumn().Width(60)
.Commands(
X.GridCommand().CommandName("Launch").Icon(Icon.ComputerGo).StandOut(true).ToolTip(tt => tt.Text = "Launch")
)
.Listeners(l => l.Command.Handler = "handleLaunch(command, record)")
.PrepareToolbar("prepareLaunchButtons")
)
),
X.TabPanel()
.ID("mainTabPanel")
.Region(Region.Center)
)
)



Script



var handleLaunch = function (command, record) {
if (command === 'Launch' && record.data.methodKey === '1') {
addTab(App.mainTabPanel, 'tab' + record.data.passwordKey, record.data.url);
} else {
App.direct.LaunchFromURL(command, record.data.methodKey, record.data.url, record.data.passwordKey, record.data.parentKey);
}
};


var addTab = function (tabPanel, id, url) {
Ext.Msg.notify('Launch', id + '|' + url);
var tab = tabPanel.getComponent(id);
if (!tab) {
tab = tabPanel.add({
id: id,
title: url,
closable: true,
loader: {
url: url,
renderer: "frame",
loadMask: {
showMask: true,
msg: "Loading " + url + "..."
}
}
});
}
tabPanel.setActiveTab(tab);
};

Daniil
Mar 06, 2014, 3:28 AM
Hi @rsnead,

Hard to say why Chrome gives access, but IE doesn't. I am not sure we can somehow affect on that.

Does it happen in any IE version?

What is the URL you load? This one?

info.url = "http://www.ext.net/";


Does it happen with other URLs?

rsnead
Mar 06, 2014, 3:57 AM
thanks Daniil

I have only tried ie version 11.
Chrome Version 33.0.1750.146

I have tried with multiple sites and have gotten the exact same response. For the most part I am verifying that have am calling this correctly to add a new tab in the tabPanel. And if you have seen this issue before with a possible resolution.

Thanks
Russ

Vladimir
Mar 06, 2014, 5:29 AM
iframe content is inaccessable for parent page if url belongs another domain. It is due same origin policy (http://en.wikipedia.org/wiki/Same-origin_policy)
If you say that Chrome allows it then it means your Chrome works in non statndard mode with low level security settings

How do you determine that Chrome allows it and IE doesn't allows it? Calling is wrapped by try/catch block therefore you will not see the exception without debugger

Did you try to debug under Chrome? I guess that IE11 is run from VS in debug mode therefore you see the exception inside VS debugger

rsnead
Mar 06, 2014, 1:41 PM
Thank Vladimir

You are correct in your assumption with regards to the debugging. I have not tried debugging with Chrome.

What i am trying to accomplish is what is setup in the TabPanel (http://mvc.ext.net/#/TabPanel_Basic/Add_Tabs/) example. How are you able to launch the various site? (in particular: http://www.sencha.com/) I am assuming it is not in the same domain as Ext.Net?

Thanks
Russ

Vladimir
Mar 06, 2014, 2:04 PM
Launch is possible, just it is not possible to get iframe content if src url is another domain
Can you explain what exactly problem do you have and what do you need to implement?

rsnead
Mar 06, 2014, 2:17 PM
I have created an app that allows users to enter their websites. When a user 'launches' a web page, I would like to add to a tabPanel, just like what is in the example (http://mvc.ext.net/#/TabPanel_Basic/Add_Tabs/). I am not trying to do anything complex. I have not seen any example or posting anywhere on the web that points me in a different direction. Any assistance would be much appreciated.

thanks
Russ

Vladimir
Mar 06, 2014, 2:23 PM
So, what exactly problems do you have? The online sample shows how to add tab and load external page

rsnead
Mar 06, 2014, 2:39 PM
Thanks for you help, Vladimir

From my example above, you can see that I have replicated the example from the website. I am wondering why I am receiving the errors while debugging, as I mentioned.

If the example works, does that mean that you have to attach to a menu item? When I publish the site, it appears to be working correctly.

Thanks
Russ

Vladimir
Mar 06, 2014, 3:00 PM
Just ignore the exception, VS intercept exceptions inside try/catch blocks, it doesn't affect on functionality and you will not see the exception if run without VS debugging

rsnead
Mar 06, 2014, 3:29 PM
Thanks Vladimir. I will take your recommends and implement.