Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
227 views
in Technique[技术] by (71.8m points)

javascript - Open popup window instead of new tab/window in USD hosted control

How to open a popup window in USD hosted control ?

Javascript code:

<script>
    function basicPopup(url) {
popupWindow = window.open(url,'popUpWindow','height=300,width=700,left=50,top=50,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes')
    }

</script>
<a href="https://www.google.com" onclick="basicPopup(this.href);return false">Open a popup window</a>

USD Window navigation rules

Route Type - Popup, Action - Show Outside , Destination - Tab

Hosting Type: Edge Process/Chrome Process.

Issue: When launching the above JS snippet in a browser, it worked as expected (popup opens with given dimensions and child window able to communicate to parent window with Post message ) whereas the same code integrated with USD, the popup launches in new tab and newly opened window unable to communicate to parent window (window.open() returns null)

Any ideas as to what I'm missing?

question from:https://stackoverflow.com/questions/65951295/open-popup-window-instead-of-new-tab-window-in-usd-hosted-control

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you let USD host all of your browser processes and unify your browser types, you may be able to access your parent windows as desired.

Create a "destination" / "child" hosted control that can receive your target navigation. Make all browsers Chrome, and if you can't do that for whatever reason, hopefully you can make them all Edge instead. In your Window Navigation Rule, instead of Show Outside, use the action Route Window, and set the Target Tab to the new child browser hosted control. Put the child browser on FloatingPanel if you prefer not to host it as a MainPanel tab.

Also, not to be redundant, but having noticed your "Chrome/Edge" hybrid hosting summary above, I would suggest doing as much as possible to eliminate the hosting of multiple browser types throughout your configuration(s). I would assume that a USD-hosted browser handing off to a "Windows hosted" browser could complicate (prevent?) your ability to find the parent window, even if the browser type inside and outside of USD are the same. To my knowledge, USD and Windows use different versions of Edge (USD has yet to integrate the new Edge, and it might never) and USD manages its own Chromium instances. I assume "Show Outside" in Chrome does not launch a new CEF process from your USD application folder, but rather just hands off to Windows, which then invokes the Chrome stand-alone application (if it is your OS default browser). There may(?) be value in testing various combinations of browser types here, if you are committed to the "Show Outside" paradigm for whatever reason.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...