ManageIframe:Manual:Frame Methods (Legacy)
This version of our Learning Center is unmaintained.
This article may be out-of-date or contain incorrect information.
Please visit the new Sencha Learning Center for up-to-date material.
From Sencha - Learn
ManagedIframe Properties and Methods
In addition to existing methods/functionality provided by Ext.Element, ManagedIFrame extends the base Element class to provide additional IFRAME-relevant features.
Component Methods
managedIframe:setSrc
Changes the current src attribute of the managed frame. Syntax:
setSrc( [ url [, discardUrl] [, callbackFn ] ])
Calling :setSrc without any parameters refreshes the frame src attribute to the last URL value provided in a previous :setSrc call. Parameter Description:
- url - (string or function) A string (or function that returns a string) resource URL to be loaded by the Component after rendering/initialization. If specified, this value is applied to the IFRAME's src attribute directly.
- discardURL - (boolean, optional) false(default) or if true, the URL parameter is not stored for use in subsequent page refreshes.
- callbackFn - (function, optional) The callback function to execute after the document has been fully loaded.
Possible events raised:
- domready
- documentloaded
- exception
Example:
mif.setSrc( newUrl, false, docLoaded ); mif.setSrc( null, false, docLoaded ); //refresh the frame with the last url specified.
managedIframe:reset
Resets the embedded document status to that of a neutral domain (or empty document). Syntax:
reset( [ url [, callbackFn ] ])
Parameter Description:
- url - (string, optional) A string resource URL to be used to reset the frame. If specified, this value is applied to the IFRAME's src attribute directly. Recommended values:
- 'javascript:false' (Ext default for SSL host pages), or
- 'javascript:void(0)'
- current value of Ext.SSL_SECURE_URL (default if not specified)
- callbackFn - (function, optional) The callback function to execute after the document has been reset.
Note: the :reset function is useful where the domain context of the embedded document must change (eg. from a foreign document domain, to content written directly to the frame document using Ext.UpdateManager.
managedIframe:update
Overwrites the current embedded document structure with a new one using UpdateManager. (Ext.UpdateManager compatible) Syntax:
update( content [, loadScripts] [, callbackFn ] )
Parameter Description:
- content - (string or Ext.DomHelper config object) representing the text/markup to be written directly to the frames document interface. The existing document is destroyed and replaced by content.
- loadScripts - (boolean, optional) if false, all <Script> tag references are removed from the content prior to the update.
- callbackFn - (function, optional) The callback function to execute after the content has been written and the document reports a loaded state.
Possible events raised:
- domready
- documentloaded
- exception
Example:
mif.update( "<div> Test content </div>", false, updCallBackFn );
managedIframe:sendMessage
Sends a message to the Window context of the components' managed IFRAME. (for implementation details, see Cross-frame messaging with ManagedIFrame)
Syntax:
sendMessage( message [, tag] [, origin ] )
Parameter Description:
- message - (mixed) the message content to be sent.
- tag - (string, optional) additional tag reference for domain identification.
- origin - (string, optional) defaults the senders document.domain.
Possible events raised:
- exception
Example:
managedIframe:get [1.1+]
Returns the Ext.Element wrapper for the DOM element/element-id located withing the scope of document object of the embedded frame, or null of not available. This provides standard Ext.Element interface interaction directly with the embedded document object.
Syntax:
get(element)
managedIframe:getDom [1.1+]
Returns the native DOM Element wrapper for the DOM element/element-id located withing the scope of document object of the embedded frame, or null of not available.
Syntax:
getDom(element)
managedIframe:select [1.1+]
Returns the Ext.CompositeElement for child nodes located withing the scope of document object of the embedded frame, or null of not available. This provides standard Ext.CompositeElement interface interaction directly with the returned node list.
Syntax:
select(selector [, unique])
Parameter Description:
- selector - the CSS selector
- unique - (boolean, optional) True to create a unique Ext.Element for each child (defaults to false, which creates a single shared flyweight object)
managedIframe:query [1.1+]
Returns the Array of child DOM Element nodes located withing the scope of document object of the embedded frame, or null of not available. (the selector should not contain an id).
Syntax:
query(selector)
Parameter Description:
- selector - the CSS selector
managedIframe:getDoc [1.1+]
Returns the Ext.Element wrapper for the document object of the embedded frame, or null of not available. This provides standard Ext.Element interface interaction directly with the embedded document object.
Syntax:
getDoc()
managedIframe:getBody [1.1+]
Returns the DOM Element for the body of the document object of the embedded frame, or null of not available.
Syntax:
getBody()
managedIframe:getDocument
Returns the document object of the embedded frame, or null of not available.
Syntax:
getDocument()
managedIframe:getDocumentURI
Returns the current URI of the embedded frame (if possible). A frames' document object is 'protected' when loaded from foreign domain, so the current URI may not be available. In that scenario, the URI value returned is the URI set programatically by the last call to the setSrc method.
Syntax:
getDocumentURI()
managedIframe:getWindow
Returns the Window object of the embedded frame, or null of not available.
Syntax:
getWindow()
managedIframe:print
Activates the print dialog for the embedded frame document.
Syntax:
print()
managedIframe:domWritable
Returns (true/false) indicating whether sufficient privilege exists to interact with the embedded documents' DOM or execute scripts with it. Note: Documents retrieved from foreign-domains will always report false.
Syntax:
domWritable()
managedIframe:toggleShim[1.1+]
This method toggles activation of a custom masking IMG (used during transparent masking operations)
Syntax:
toggleShim()
managedIframe:showMask
This method activates the configured loadMask (if enabled). Syntax:
showMask([msg, [, msgClass]])
Parameter Description:
- msg - (string, optional) the message text/markup to be display while the loadMask is visible. (default: the msg property defined in the loadMask config options)
- msgClass - (string, optional) the CSS className applied to msg element if provided (default: 'x-mask-loading')
managedIframe:hideMask
This method deactivates the currently display loadMask (if enabled). Syntax:
hideMask([ forced ])
Parameter Description:
- forced - (boolean, optional) forcefully hides the loadMask regardless of the document ready state.
