public static void TestIsArrayFromIFrame() { var frame = new HTMLIFrameElement(); Document.Body.AppendChild(frame); try { dynamic xFrame = Window.Frames[Window.Frames.Length - 1]; object xArray = xFrame.Array; // Create an array in the iframe var array = Script.Write <int[]>("new {0}(1,2,3)", xArray); var contains = array.Contains(3); Assert.True(contains, "Checks that an array [1, 2, 3] created in another frame contains 3"); var isArray = BridgeHelper.isArray(array); Assert.True(isArray, "Checks that an array created in another frame returns true for Bridge.isArray(array)"); } finally { if (frame != null && frame.ParentNode != null) { frame.ParentNode.RemoveChild(frame); } } }
public static HTMLIFrameElement IFrame(Attributes init, params HTMLElement[] children) { var a = new HTMLIFrameElement(); init?.InitIFrameElement(a); AppendElements(a, children); return(a); }
protected override void Initialise() { Content = new HTMLIFrameElement(); FillControlWithParent(Content, 6, 6); Text = "Quick Search"; Body.AppendChild(Content); }
public Task <FileModel> RunHttpRequestReturningAttachmentImplStr(string interfaceName, string methodName, string inputParam) { var url = string.Format("/{0}/{1}", interfaceName, methodName); Logger.Debug(typeof(BridgeHttpRequester), "POST via iframe url={0} params={1}", url, inputParam); //create form post within iframe. This will download file and should put eventual error page into new window (thus not breaking singlepageapp too hard) var iframe = new HTMLIFrameElement(); iframe.Style.Visibility = Visibility.Hidden; Document.Body.AppendChild(iframe); var form = new HTMLFormElement(); form.Target = "_blank"; form.Method = "POST"; form.Action = url; form.AppendChild(new HTMLInputElement { Type = InputType.Hidden, Name = Magics.PostReturningFileParameterName, Value = inputParam }); if (Toolkit.CsrfToken != null) { form.AppendChild(new HTMLInputElement { Type = InputType.Hidden, Name = Philadelphia.Common.Model.Magics.CsrfTokenFieldName, Value = Toolkit.CsrfToken }); } iframe.AppendChild(form); form.Submit(); Document.Body.RemoveChild(iframe); return(Task.FromResult( FileModel.CreateDownloadRequest( url, new Tuple <string, string>( Magics.PostReturningFileParameterName, inputParam)))); }