Page 2 of 60 FirstFirst 12341252 ... LastLast
Results 11 to 20 of 591

Thread: ux.ManagedIframePanel (1.05, 1.0 baseline closed)

  1. #11

    Default

    I tried your example and now able to load my legacy html into the desktop window demo, there are some hyper links are using javascript function in my legacy html (some inline, some referece to other js file), it seems these javascripts function are not found when I click them, both IE and firefox give error said function is not defined.

    any idea how to make them visible to these iframe html?

  2. #12
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    @davidchantf - You must consider that an iframe does not share the Javascript context of it's parent browser page.

    If you have dependent functions required to support the Iframes document, those function/libraries must be defined/loaded there (within the IFrames Document) as well.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  3. #13

    Default

    Something wrong in somewhere, my iframe is loaded, but whenever I click on a link inside iframe, which use javascript function defined within the iframe html, browser said function is not defined, the same page works fine when loaded outside iframe.

    I even tested to call the iframe javascript function from main window, and that works. I checked the DOM in firebug, and see these javascript functions are defined in contentWindow of the iframe.

    This only happens to my legacy html, which is very complex with a lot of javascript functions.

    When I write a simple test html with a couple of javascript functions in iframe, then everything works fine.

    but why it is not visible within iframe itself for this complex html?

    any idea where I should look at?

    thanks.

  4. #14
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Question

    Are your iframes functions defined/loaded via <script> tags using a relative path-name ("../../js/myFuncs.js")?

    Iframes would typically (might) need to use absolute pathnames in such URLs.
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  5. #15

    Default

    It turns out there is <base target="_top"> in my leagcy html cause problem, after I removed this line, now all these javascript functions works.

    I am not sure why this is problem, or at least the firefox should give better error mesg.

  6. #16
    Sencha User
    Join Date
    May 2007
    Posts
    196

    Default

    Hi henricd,

    great stuff, just what I've been looking for ;-)

    But I have a question - how do i dynamically change the source of the Iframe?
    I tried it with
    Code:
    Ext.get('my_iframe_id').src = 'http://www.extjs.com';
    but this doesn't work. Nothing happens.

    Code:
    document.getElementById('my_iframe_id').src = 'http://www.extjs.com';
    works, though.

    Can you give me a hint on this? Maybe a setSource() method could be implemented?

    Bye, Stephan

  7. #17
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    Ext.get('my_iframe_id').dom.src = 'http://www.extjs.com';
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


  8. #18

    Lightbulb

    Quote Originally Posted by hendricd View Post
    But, to answer to your, question... Yes it is possible to eval a modified (for IE) version of ext-all.js (or better yet, package deployment) into the IFrame window context. It can be done either thru execScript or using the reverse method: (accessing the (cached somewhere) source strings directly from the parent like:
    I want to share the Ext code between one top level window and all its frames or iframes (or popup windows, for that matter) using NO reloading or even reevaluating of ext-all.js? I would like to do something like the following in an iframe:

    Code:
    Ext = new parent.Ext(window); // make window-local instance of Ext
    // and then use Ext normally:
    if (Ext.isReady) whatever...
    Every reference to Ext in the shared Ext library code would have to be changed to something like Ext.self, and instead of accessing window directly, shared code should use Ext.self.window. These properties (Ext.self and Ext.self.window) would be set up by the Ext constructor. Then any other non-shared code could use this localized Ext object as is without changes.

    Another possibility is to have every Ext component know its window-local ext instance, but this requires more space storing this singleton (one per window) in each component.

    This seems doable to me. Is it worth the trouble? Loading/evaluating the the ExtJS code requires about 1/2 second on my machine, and these add up across each iframe. ExtJS and additional libraries could grow to a much larger size if we didn't have to worry about the load time for each page.

  9. #19

    Red face

    Well, on reflection, it doesn't help if Ext code references Ext.self because that would still be the same global Ext rather than the local Ext that I was intending. (If you don't follow that, never mind - I was confused too. )

    Basically there is no way to get the local Ext context without storing it (directly or indirectly) in each component.

  10. #20
    Sencha User hendricd's Avatar
    Join Date
    Aug 2007
    Location
    Long Island, NY USA
    Posts
    5,966

    Default

    Basically there is no way to get the local Ext context without storing it (directly or indirectly) in each component.
    Correct, the only way you'll get a 'useful' Ext (window.document) context for your Iframe, is either:

    a) load ext-all.js via script tag in your IFrame's document (likely cached, but still expensive), or..
    b) eval the contents (of a modified for IE - EventManager) ext-all.js into the iframes window(global) namespace, (but you must 'own' the Iframes' document to do that). That's also specifically why ux.ManagedIframe.execScript was implemented
    "be dom-ready..."
    Doug Hendricks

    Maintaining ux: ManagedIFrame, MIF2 (FAQ, Wiki), ux.Media/Flash, AudioEvents, ux.Chart[Fusion,OFC,amChart], ext-basex.js/$JIT, Documentation Site.


    Got Sencha licensing questions? Find out more here.


Page 2 of 60 FirstFirst 12341252 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •