Page 1 of 1

nested iframe postmessage don't fired the message event

Posted: Thu Sep 29, 2022 9:17 am
by 312684696
1.png
in my page,an iframe named "cframe" in a parent iframe named "pframe".
pframe postmessage fired the OnFrameWebMsgRec event.
but the cframe didn't;

Code: Select all

WVBrowser1FrameCreated
....
var
  TempArgs: TCoreWebView2FrameCreatedEventArgs;
  TempFrame: TCoreWebView2Frame;
begin
  TempArgs := TCoreWebView2FrameCreatedEventArgs.Create(aArgs);
  Inc(FFrameIndex);
  TempFrame := TCoreWebView2Frame.Create(TempArgs.Frame, FFrameIndex);
  try
    TempFrame.AddAllBrowserEvents(WVBrowser1);
    Fframes.Add(FFrameIndex, TempFrame);
  finally
    TempArgs.Free;
  end;
  
by above code ,the cframe's FrameIndex is 1,the pframe's FrameIndex is 2.

Re: nested iframe postmessage don't fired the message event

Posted: Thu Sep 29, 2022 5:06 pm
by salvadordf
Hi,

That's unexpected. If that event works for the parent frame it should also work for the child frame.
This might be an issue in the WebView2 framework.

Please, report this issue in the WebView2Feedback repository :
https://github.com/MicrosoftEdge/WebView2Feedback

Re: nested iframe postmessage don't fired the message event

Posted: Fri Sep 30, 2022 12:27 am
by 312684696
Thx, I'll give it a try

Re: nested iframe postmessage don't fired the message event

Posted: Sun Oct 02, 2022 5:20 pm
by salvadordf
For anyone interested in this issue, these are the links to the feedback repository :
https://github.com/MicrosoftEdge/WebView2Feedback/issues/2836
https://github.com/MicrosoftEdge/WebView2Feedback/issues/2440

This feature is not supported right now but it's on their backlog.

Re: nested iframe postmessage don't fired the message event

Posted: Fri Nov 11, 2022 7:27 am
by 312684696
thank you