GWT SDK does not have a Java method to change the Location of the top most 
window from within an iframe.

You could use elemental2 library which provides access to most JavaScript 
DOM API. Using elemental2 you can do 
DomGlobal.window.top.location.replace/assign(url)

But this will only work if both the main page and the iframe page are 
served from the same origin/domain. If main page is served from 
https://main.company.com/ and the iframe from https://iframe.company.com/ 
then some internet articles might tell you to set the Javascript property 
document.domain = company.com so that the browsers same-origin-policy uses 
only company.com. But document.domain is deprecated and instead you should 
use window.postMessage(). This allows you to send a message from the iframe 
to the main page. The main page would listen for messages and then reload 
itself if the message tells it to do so. The elemental2 library also 
provides an API for window.postMessage.

-- J.

bandya...@gmail.com schrieb am Montag, 8. Mai 2023 um 07:50:47 UTC+2:

> I am using the Window.Location provided by GWT
>
> https://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/Window.Location.html
>
> On Saturday, 6 May 2023 at 23:57:00 UTC+5:30 Vassilis Virvilis wrote:
>
>> Hi,
>>
>> It is not clear from your description but let's assume that you have 2 
>> GWT applications. One runs at the toplevel window and one runs in an 
>> iframe. At some point you want to reload the main page from the iframe.
>>
>> The thing is the iframe thinks it runs in the main window. You have to 
>> access the parent and do the reload.
>>
>> If the iframe and the main window is on the same domain then
>>
>>    - 
>>    https://stackoverflow.com/questions/11207900/change-parent-url-from-iframe
>>    - 
>>    
>> https://stackoverflow.com/questions/4361479/how-do-i-change-the-url-of-the-parent-frame
>>
>> If the iframe and main window are not on the same domain then maybe it is 
>> more difficult.
>>
>> Hope that helps.
>>
>>
>> On Sat, May 6, 2023 at 1:04 PM JaldiSeDekho <bandya...@gmail.com> wrote:
>>
>>> Hi Everyone,
>>>
>>> I am having a GWT page with a Header, Left Nav and an iFrame besides the 
>>> left nav which reloads.
>>>
>>> After a particular condition on a button reload I want the complete 
>>> browsers page to reload, hence I am hitting the Window.Location.reload() 
>>> however this is reloading the iFrame and not the browsers page.
>>> I even tried to assign Window.Location.assign(<URL>) like this, however 
>>> it opened the URL inside the iFrame.
>>>
>>> Kindly help how I can reload the browsers window completely.
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "GWT Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to google-web-tool...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/google-web-toolkit/dd2d3dfd-346d-4135-ab67-569462322862n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/google-web-toolkit/dd2d3dfd-346d-4135-ab67-569462322862n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> -- 
>> Vassilis Virvilis
>>
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/834cac44-ef29-4868-8076-879d83e8b493n%40googlegroups.com.

Reply via email to