Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Access browser URL
Access browser URL [message #660829] Mon, 21 March 2011 20:09 Go to next message
Eclipse UserFriend
Originally posted by: karsten.triadiary.com

Hi,

I hope that's an easy question. How can I access the URL currently shown
in the browser? I have a RAP application that might run in an IFrame and
I need the complete page URL and not only the URL of my application.

Any hints?

Thanks.

Karsten
Re: Access browser URL [message #660888 is a reply to message #660829] Tue, 22 March 2011 09:10 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Karsten,
due to browser security policies it's not possible to access the browser
URL (javascript top.location object) from the iframe (your application)
if they origin from different domains. In theory, it's possible if they
come from the same domain. You could try to write the custom javascript
on the client that read and put the URL in the request as parameter and
read it from within your application. See this example as an outline how
to write custom javascript and handle the parameter from the request:
http://wiki.eclipse.org/RAP/FAQ#How_do_I_implement_a_key_bin ding_that_triggers_a_Command.3F
HTH,
Ivan

On 3/21/2011 10:09 PM, Karsten Voigt wrote:
> Hi,
>
> I hope that's an easy question. How can I access the URL currently
> shown in the browser? I have a RAP application that might run in an
> IFrame and I need the complete page URL and not only the URL of my
> application.
>
> Any hints?
>
> Thanks.
>
> Karsten
Re: Access browser URL [message #660930 is a reply to message #660888] Tue, 22 March 2011 12:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: karsten.triadiary.com

Hi,

thanks for the quick answer, now I have to think about another solution
for my problem.

Maybe you can answer the following question (or at least have an idea/
link).

I try to cover the following scenario:

1. RAP application runs in an IFrame
2. User clicks a button that opens a new browser window (from my RAP
application)
3. Some strange stuff is done in the new browser window (no RAP page)
4. Redirect in the new browser window that closes the new window

How can I monitor the lifecycle of the new window. On window close I'd
like to read the current URL of the new browser window (just before the
window is closed) and do some actions in my RAP application based on
that URL (and finally update my RAP UI).

Thanks for any hints/ help.

Karsten

Am 22.03.2011 10:10, schrieb Ivan Furnadjiev:
> Hi Karsten,
> due to browser security policies it's not possible to access the browser
> URL (javascript top.location object) from the iframe (your application)
> if they origin from different domains. In theory, it's possible if they
> come from the same domain. You could try to write the custom javascript
> on the client that read and put the URL in the request as parameter and
> read it from within your application. See this example as an outline how
> to write custom javascript and handle the parameter from the request:
> http://wiki.eclipse.org/RAP/FAQ#How_do_I_implement_a_key_bin ding_that_triggers_a_Command.3F
>
> HTH,
> Ivan
>
> On 3/21/2011 10:09 PM, Karsten Voigt wrote:
>> Hi,
>>
>> I hope that's an easy question. How can I access the URL currently
>> shown in the browser? I have a RAP application that might run in an
>> IFrame and I need the complete page URL and not only the URL of my
>> application.
>>
>> Any hints?
>>
>> Thanks.
>>
>> Karsten
Re: Access browser URL [message #660940 is a reply to message #660930] Tue, 22 March 2011 12:22 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Karsten,
there is no big difference from my previous answer - browser security
policies will prevent the reading of javascript window.location object
if the new window page does not come from the same domain with your
application. That's why, you first have to answer the question: Is the
"no RAP page" (and all sequential loaded pages by link) comes from the
same domain with your RAP application or not?
Best,
Ivan

On 3/22/2011 2:11 PM, Karsten Voigt wrote:
> Hi,
>
> thanks for the quick answer, now I have to think about another
> solution for my problem.
>
> Maybe you can answer the following question (or at least have an idea/
> link).
>
> I try to cover the following scenario:
>
> 1. RAP application runs in an IFrame
> 2. User clicks a button that opens a new browser window (from my RAP
> application)
> 3. Some strange stuff is done in the new browser window (no RAP page)
> 4. Redirect in the new browser window that closes the new window
>
> How can I monitor the lifecycle of the new window. On window close I'd
> like to read the current URL of the new browser window (just before
> the window is closed) and do some actions in my RAP application based
> on that URL (and finally update my RAP UI).
>
> Thanks for any hints/ help.
>
> Karsten
>
> Am 22.03.2011 10:10, schrieb Ivan Furnadjiev:
>> Hi Karsten,
>> due to browser security policies it's not possible to access the browser
>> URL (javascript top.location object) from the iframe (your application)
>> if they origin from different domains. In theory, it's possible if they
>> come from the same domain. You could try to write the custom javascript
>> on the client that read and put the URL in the request as parameter and
>> read it from within your application. See this example as an outline how
>> to write custom javascript and handle the parameter from the request:
>> http://wiki.eclipse.org/RAP/FAQ#How_do_I_implement_a_key_bin ding_that_triggers_a_Command.3F
>>
>>
>> HTH,
>> Ivan
>>
>> On 3/21/2011 10:09 PM, Karsten Voigt wrote:
>>> Hi,
>>>
>>> I hope that's an easy question. How can I access the URL currently
>>> shown in the browser? I have a RAP application that might run in an
>>> IFrame and I need the complete page URL and not only the URL of my
>>> application.
>>>
>>> Any hints?
>>>
>>> Thanks.
>>>
>>> Karsten
>
Re: Access browser URL [message #660941 is a reply to message #660940] Tue, 22 March 2011 12:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: karsten.triadiary.com

Hi Ivan,

my RAP page runs in an IFrame and the IFrame can be in 'any' page (I
can't say who will use that RAP application). The new window will open a
page in another domain that will redirect to a page in the domain also
used for the RAP application.

Best,
Karsten


Am 22.03.2011 13:22, schrieb Ivan Furnadjiev:
> Hi Karsten,
> there is no big difference from my previous answer - browser security
> policies will prevent the reading of javascript window.location object
> if the new window page does not come from the same domain with your
> application. That's why, you first have to answer the question: Is the
> "no RAP page" (and all sequential loaded pages by link) comes from the
> same domain with your RAP application or not?
> Best,
> Ivan
>
> On 3/22/2011 2:11 PM, Karsten Voigt wrote:
>> Hi,
>>
>> thanks for the quick answer, now I have to think about another
>> solution for my problem.
>>
>> Maybe you can answer the following question (or at least have an idea/
>> link).
>>
>> I try to cover the following scenario:
>>
>> 1. RAP application runs in an IFrame
>> 2. User clicks a button that opens a new browser window (from my RAP
>> application)
>> 3. Some strange stuff is done in the new browser window (no RAP page)
>> 4. Redirect in the new browser window that closes the new window
>>
>> How can I monitor the lifecycle of the new window. On window close I'd
>> like to read the current URL of the new browser window (just before
>> the window is closed) and do some actions in my RAP application based
>> on that URL (and finally update my RAP UI).
>>
>> Thanks for any hints/ help.
>>
>> Karsten
>>
>> Am 22.03.2011 10:10, schrieb Ivan Furnadjiev:
>>> Hi Karsten,
>>> due to browser security policies it's not possible to access the browser
>>> URL (javascript top.location object) from the iframe (your application)
>>> if they origin from different domains. In theory, it's possible if they
>>> come from the same domain. You could try to write the custom javascript
>>> on the client that read and put the URL in the request as parameter and
>>> read it from within your application. See this example as an outline how
>>> to write custom javascript and handle the parameter from the request:
>>> http://wiki.eclipse.org/RAP/FAQ#How_do_I_implement_a_key_bin ding_that_triggers_a_Command.3F
>>>
>>>
>>> HTH,
>>> Ivan
>>>
>>> On 3/21/2011 10:09 PM, Karsten Voigt wrote:
>>>> Hi,
>>>>
>>>> I hope that's an easy question. How can I access the URL currently
>>>> shown in the browser? I have a RAP application that might run in an
>>>> IFrame and I need the complete page URL and not only the URL of my
>>>> application.
>>>>
>>>> Any hints?
>>>>
>>>> Thanks.
>>>>
>>>> Karsten
>>
Re: Access browser URL [message #660967 is a reply to message #660941] Tue, 22 March 2011 14:00 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Karsten,
to my knowledge, it's not possible to achieve this without a full
control over the new opened window (document).
Best,
Ivan

On 3/22/2011 2:46 PM, Karsten Voigt wrote:
> Hi Ivan,
>
> my RAP page runs in an IFrame and the IFrame can be in 'any' page (I
> can't say who will use that RAP application). The new window will open
> a page in another domain that will redirect to a page in the domain
> also used for the RAP application.
>
> Best,
> Karsten
>
>
> Am 22.03.2011 13:22, schrieb Ivan Furnadjiev:
>> Hi Karsten,
>> there is no big difference from my previous answer - browser security
>> policies will prevent the reading of javascript window.location object
>> if the new window page does not come from the same domain with your
>> application. That's why, you first have to answer the question: Is the
>> "no RAP page" (and all sequential loaded pages by link) comes from the
>> same domain with your RAP application or not?
>> Best,
>> Ivan
>>
>> On 3/22/2011 2:11 PM, Karsten Voigt wrote:
>>> Hi,
>>>
>>> thanks for the quick answer, now I have to think about another
>>> solution for my problem.
>>>
>>> Maybe you can answer the following question (or at least have an idea/
>>> link).
>>>
>>> I try to cover the following scenario:
>>>
>>> 1. RAP application runs in an IFrame
>>> 2. User clicks a button that opens a new browser window (from my RAP
>>> application)
>>> 3. Some strange stuff is done in the new browser window (no RAP page)
>>> 4. Redirect in the new browser window that closes the new window
>>>
>>> How can I monitor the lifecycle of the new window. On window close I'd
>>> like to read the current URL of the new browser window (just before
>>> the window is closed) and do some actions in my RAP application based
>>> on that URL (and finally update my RAP UI).
>>>
>>> Thanks for any hints/ help.
>>>
>>> Karsten
>>>
>>> Am 22.03.2011 10:10, schrieb Ivan Furnadjiev:
>>>> Hi Karsten,
>>>> due to browser security policies it's not possible to access the
>>>> browser
>>>> URL (javascript top.location object) from the iframe (your
>>>> application)
>>>> if they origin from different domains. In theory, it's possible if
>>>> they
>>>> come from the same domain. You could try to write the custom
>>>> javascript
>>>> on the client that read and put the URL in the request as parameter
>>>> and
>>>> read it from within your application. See this example as an
>>>> outline how
>>>> to write custom javascript and handle the parameter from the request:
>>>> http://wiki.eclipse.org/RAP/FAQ#How_do_I_implement_a_key_bin ding_that_triggers_a_Command.3F
>>>>
>>>>
>>>>
>>>> HTH,
>>>> Ivan
>>>>
>>>> On 3/21/2011 10:09 PM, Karsten Voigt wrote:
>>>>> Hi,
>>>>>
>>>>> I hope that's an easy question. How can I access the URL currently
>>>>> shown in the browser? I have a RAP application that might run in an
>>>>> IFrame and I need the complete page URL and not only the URL of my
>>>>> application.
>>>>>
>>>>> Any hints?
>>>>>
>>>>> Thanks.
>>>>>
>>>>> Karsten
>>>
>
Previous Topic:Proposed Q&A site for Eclipse RAP
Next Topic:Hanged sessions
Goto Forum:
  


Current Time: Thu Apr 18 03:54:13 GMT 2024

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

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

Back to the top