Sarjith Pullithodi
Sarjith Pullithodi

Reputation: 89

Access newly Opened window in gwt

I am trying to achieve something like below through GWT (below code is javascript).

function openWin() {
   var myWindow=window.open('','','width='+screen.width+',height='+screen.height+',left='+screen.width);
   myWindow.document.write("<p>This is 'myWindow'</p>");
   myWindow.document.write("<span id='span'></span>");
   myWindow.document.close();

   myWindow.document.getElementById('span').innerText = 'something';
}

How can I achieve this in gwt, when i try this javascript code itself, inside my gwt project, left='+screen.width is not seems to be working in FF and myWindow.document.getElementById('span').innerText = 'something'; is not seems to be working in chrome. correcting them in javascript is also fine for me, as long as it works perfect for both FF and chrome.

Regarding using the PopupPanel of gwt, that also wouldnt help me. As far as I know, PopupPanel can't be poped out of the page. In my scenario, the new window should be opened in my secondory display (which can be achieved with current js code. using code 'width='+screen.width+',height='+screen.height+',left='+screen.width. (If I am wrong please guide me to know about such property of PopupPanel.

Upvotes: 0

Views: 163

Answers (1)

Ganesh Kumar
Ganesh Kumar

Reputation: 3250

If you want to open something in a separate window in GWT, then you can have a GWT module which has its own hosted page. That module can have your desired display/logic. You can open this page using Window.open from another GWT module.

Upvotes: 1

Related Questions