Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » javascript: cannot access parent window
javascript: cannot access parent window [message #1780501] Tue, 23 January 2018 13:39 Go to next message
Luca Paoli is currently offline Luca PaoliFriend
Messages: 3
Registered: January 2018
Junior Member
Is there a way to access a parent window via Javascript in RAP?

This is my scenario:
I have two web applications, let's call them app A and app B.
App A opens a modal dialog in Javascript
var result = window.showModalDialog(url to app B, window.self, "")

then app B returns a value in this way
window.returnValue = some value; 

So when the user closes the modal dialog, the caller reads back the value inside the variable result.

App B has been replaced by a RAP application, and I need to pass the value back to the caller app. So I tried to use the same Javascript code in RAP like this:
JavaScriptExecutor executor = client.getService(JavaScriptExecutor.class);
  if(executor != null) { 
    executor.execute("window.returnValue = some value; ");

This doesn't work, the parent window gets undefined as a value for result.
I also tried to access the parent window with
var parent = window.dialogArguments;

but the result is undefined.

Is there a way to approach this problem in RAP?
Re: javascript: cannot access parent window [message #1780819 is a reply to message #1780501] Sun, 28 January 2018 19:43 Go to previous message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
Do the URL's of both apps have the same host, port and scheme?
If not, you'll have to figure out a way to do cross-domain communication. This isn't an issue caused by RAP, it's a generic Javascript issue.
Previous Topic:change the background to transparent for custom widget parent?
Next Topic:Toolbar Get / Lost Focus events handles different from SWT
Goto Forum:

Current Time: Mon Dec 06 20:49:43 GMT 2021

Powered by FUDForum. Page generated in 0.02461 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top