Open a new browser window in GWT containing the widget / panel

I know that you can open a new browser window using the Window.open () function, directing it to a specific URL. However, is it possible to open a new browser window with the GWT panel? And if so, can someone show an example of this?

+3
source share
1 answer

Here is my idea. I implemented it in pure JavaScript, but if it is possible in JS, it should also be possible with GWT!

parent.html:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Parent page</title>
<script type="text/javascript">
    function openChild() {
            window.mychild = window.open("print.html");
            setTimeout('setContent();', 2000);
    }
    function setContent() {
            window.mychild.document.body.innerHTML = 
               '<b>Here is your dynamically generated print content</b>';
               // This could be produced by your main GWT module.
    }
</script>
</head>
<body>
    <a href="#" onclick="javascript:openChild()">Open child window</a>
</body>
</html>

print.html:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Print view</title>
</head>
<body>
    One moment please...
</body>
</html>

Please note that I used a timeout. This is not ideal, because if (very small) print.html takes longer, then it will overwrite the dynamically configured content.

, ( , , " " ).

+1

Source: https://habr.com/ru/post/1749285/


All Articles