Get current iFrame's location

  1. #1

    Get current iFrame's location

    Hi there, I would like to know if it possible to retrieve the current iFrame's Url location using an Ext.Panel. Suppose you have a web application and you load inside an Ext.NET Panel an external web site. This external website is loaded in iFrame mode. You know the Panel's loader's Url (since you set it by loader.Url property) but what if the user navigates through this iframe in other urls? For example let's say that you set loader.Url = http://www.samplesite.com. Then the user inside this external website in iframe mode, clicks a link and navigates to http://www.samplesite.com/products. Is it possible to retrieve the http://www.samplesite.com/products value of the cross-domain iframe? I have heard of the ManagedIframe class of ExtJS but Im not sure if that's the answer.

    Many thanks.
  2. #2
    I don't think what you're asking for is possible because of security restrictions in the browser if the iframe is loaded with a page that is not in the same domain.

    If the iframe page was in the same domain as the parent, then you could use the following JavaScript to access the location:

    App.Panel1.getBody().location.href
    If the iframe page is in another domain, the browser is going to throw a "Permission Denied" error.

    See also

    http://en.wikipedia.org/wiki/Same_origin_policy

    https://developer.mozilla.org/en-US/...for_JavaScript

    Hope this helps.
    Geoffrey McGill
    Founder

Similar Threads

  1. Location of Ext.NET v1 dll's
    By devil in forum 2.x Help
    Replies: 3
    Last Post: Mar 25, 2013, 2:16 PM
  2. [CLOSED] Scroll Bar location
    By canbay in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 24, 2013, 11:43 AM
  3. [CLOSED] Setting StoreID on GridFilter to IFrame location
    By peter.campbell in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 27, 2012, 1:39 PM
  4. Location Path
    By lindgrenm in forum 1.x Help
    Replies: 3
    Last Post: Jun 03, 2010, 11:34 PM
  5. Download location for 0.6
    By mthird in forum 1.x Help
    Replies: 1
    Last Post: Jan 07, 2009, 2:23 PM

Tags for this Thread

Posting Permissions