You could implement a backend proxy that fetches the html page, parses 
the content to patch all link references to go back through the proxy 
prior to sending the modified page to the browser.  Since the browser 
thinks the iFrame pages are loaded form the backend proxy (same domain 
as the rest of your GWT app), the cross domain security issues won't be 
a problem.

Tom


Jayant wrote:
> Hello,
>
> I am trying to create an application where I have to watch the
> location and content of an iframe. I wrote a simple prototype where a
> top page contains 2 iframes. One is used for the real content and one
> just contains a script that watches the content iframe. Now as long as
> the pages in the iframe are coming from the same server, this works.
> However when the user navigates to a page from another server, the
> scheme fails. I cannot stop the user from going to any other page in
> that iframe. I only need to know where the iframe is pointing to. I
> have gone through a numerous references on the cross domain security
> and there does not seem to be an answer to this. I have two questions:
> 1. Is this impossible to resolve in pure javascript. May be there is
> some scheme used by portlets that could help and 2. Can use of flash /
> flex help get over this problem.
>
> Following is the code for the four files in the little prorotype.
>
> ------------------main.html-------------------
> <html>
> <head>
> <title>Main Co-Browser Page</title>
> <script language="javascript">
> function getContentURL()
> {
>         d = document;
>         f = d.frames ? d.frames['content'] : d.getElementById('content');
>         var  url = "";
>         try
>         {
>                 if (f.getCurrentLocation)
>                 {
>                         url = f.getCurrentLocation();
>                 }
>                 else if (f.contentWindow.getCurrentLocation)
>                 {
>                         url = f.contentWindow.getCurrentLocation();
>                 }
>         }
>         catch(e)
>         {
>                 url = "";
>         }
>   return        url;
> }
> </script>
> </head>
> <body>
>  <iframe id="content" src="sample1.html" width="100%" height="200px"></
> iframe>
>  <iframe id="tracker" src="tracker.html"></iframe>
> </body>
> </html>
> ---------------------------------------------------
> ---------------------sample1.html------------------
> <html>
> <head>
> <title>Sample1</title>
> <script language="javascript">
> function getCurrentLocation()
> {
>   return        document.location;
> }
> </script>
> </head>
> <body>
> <p>This is page sample 1
> <p><a href="sample2.html">Sample2</a>
> <p><a href="http://www.google.com";>Google</a>
> </body>
> </html>
> ---------------------------------------------------
> ---------------------sample2.html------------------
> <html>
> <head>
> <title>Sample1</title>
> <script language="javascript">
> function getCurrentLocation()
> {
>   return        document.location;
> }
> </script>
> </head>
> <body>
> <p>This is page sample 2
> <p><a href="sample1.html">Sample1</a>
> <p><a href="http://www.yahoo.com";>Yahoo</a>
> </body>
> </html>
> ---------------------------------------------------
> ---------------------tracker.html------------------
> <html>
> <head>
> <title>Tracker</title>
> <script language="javascript">
> function test()
> {
> var frameUrl = parent.getContentURL();
> if (frameUrl == "")
> {
>   alert("Content is out of scope");
> }
> else
> {
>   alert('frameUrl = '+frameUrl);
> }
> setTimeout("test()", 3000);
> }
> var timerID = setTimeout("test()", 3000);
> </script>
> </head>
> <body>
> </body>
> </html>
> ---------------------------------------------------
>
> Thanks,
> -Jayant.
>
>
> >   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to