You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello.
I am currently developing a Win32 C++ based WebView2 program.
I am writing this post because I have a question regarding WebView2.
I know that Webview2 API provides a callback that can be handled when calling window.open.
(add_NewWindowRequested and ICoreWebView2NewWindowRequestedEventHandler)
By setting put_Handled(true) in ICoreWebView2NewWindowRequestedEventArgs obtained within the callback, or using put_NewWindow, you can open the WebView2 window that you newly create.
Alternatively, I understand that if the request is not handled, a popup created by the Edge engine itself will be displayed.
(In this case, if you enter window.chrome.webview into that window through developer tools, it will be displayed as undefined.)
Question)
About this question, popups generated by the Edge engine (NewWindowRequested not handled) window.resizeTo works fine. window.resizeTo does not work on newly created WebView2 windows via NewWindowRequested.
Q1) Is there a way to handle that event?
(Even if I checked with Spy++, no special events(window messsge) are received in the WebView 2 popup I created.)
(It seems that windows created in the Edge engine internally receive events through some means and adjust the window through SetWindowPos.)
Q2) According to Mozilla MDN, for window.resizeTo to work, the window must be opened as a popup(not tab) and as window.open. Is the window opened with NewWindowRequested recognized as a 'tab'? In this case, is resizeTo not working due to policy?
If there is no other way, try to handle resize natively by calling postMessage in javascript.I've been struggling for a long time to find a solution to this problem.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
hello.
I am currently developing a Win32 C++ based WebView2 program.
I am writing this post because I have a question regarding WebView2.
I know that Webview2 API provides a callback that can be handled when calling window.open.
(add_NewWindowRequested and ICoreWebView2NewWindowRequestedEventHandler)
By setting put_Handled(true) in ICoreWebView2NewWindowRequestedEventArgs obtained within the callback, or using put_NewWindow, you can open the WebView2 window that you newly create.
Alternatively, I understand that if the request is not handled, a popup created by the Edge engine itself will be displayed.
(In this case, if you enter window.chrome.webview into that window through developer tools, it will be displayed as undefined.)
Question)
About this question, popups generated by the Edge engine (NewWindowRequested not handled) window.resizeTo works fine.
window.resizeTo does not work on newly created WebView2 windows via NewWindowRequested.
Q1) Is there a way to handle that event?
(Even if I checked with Spy++, no special events(window messsge) are received in the WebView 2 popup I created.)
(It seems that windows created in the Edge engine internally receive events through some means and adjust the window through SetWindowPos.)
Q2) According to Mozilla MDN, for window.resizeTo to work, the window must be opened as a popup(not tab) and as window.open. Is the window opened with NewWindowRequested recognized as a 'tab'? In this case, is resizeTo not working due to policy?
If there is no other way, try to handle resize natively by calling postMessage in javascript.I've been struggling for a long time to find a solution to this problem.
help :(
Beta Was this translation helpful? Give feedback.
All reactions