HTML::Object::DOM::Element::IFrame - HTML Object DOM iFrame Class
use HTML::Object::DOM::Element::IFrame; my $iframe = HTML::Object::DOM::Element::IFrame->new || die( HTML::Object::DOM::Element::IFrame->error, "\n" );
v0.2.0
The HTML::Object::DOM::Element::IFrame interface provides special properties and methods (beyond those of the HTML::Object::Element interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements.
+-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +------------------------------------+ | HTML::Object::Element | --> | HTML::Object::EventTarget | --> | HTML::Object::DOM::Node | --> | HTML::Object::DOM::Element | --> | HTML::Object::DOM::Element::IFrame | +-----------------------+ +---------------------------+ +-------------------------+ +----------------------------+ +------------------------------------+
Inherits properties from its parent HTML::Object::DOM::Element
Provided with a string and this set or get the attribute that specifies the alignment of the frame with respect to the surrounding context.
See also Mozilla documentation
A list of origins the frame is allowed to display content from. This attribute also accepts the values self and src which represent the origin in the iframe's src attribute. The default value is src.
A boolean value indicating whether the inline frame is willing to be placed into full screen mode. See Using full-screen mode for details. This defaults to false.
This does nothing and returns undef under perl environment.
undef
In JavaScript environment, this returns a Document, the active document in the inline frame's nested browsing context.
Document
Maybe, in the future, this could fetch the remote page at the specified url, parse the html and return its HTML::Object::DOM object?
Normally this returns undef under perl, but you can set a HTML::Object::DOM::WindowProxy object.
In JavaScript environment, this returns a WindowProxy, the window proxy for the nested browsing context.
WindowProxy
Provided with a value and this sets or gets the attribute that specifies the Content Security Policy that an embedded document must agree to enforce upon itself.
Read-only.
In JavaScript environment, this returns the FeaturePolicy interface which provides a simple API for introspecting the feature policies applied to a specific document.
FeaturePolicy
Provided with a string (yes or no) or a integer (1 or 0) and this will set or get the HTML attribute to indicate whether to create borders between frames.
yes
no
Example:
$iframe->frameBorder = 1;
A string that reflects the height HTML attribute, indicating the height of the frame.
A string that contains the URI of a long description of the frame.
<img src="some_pic.png" id="myPicture" height="1024" width="512" longdesc="/some/where/longdescription.html" />
A string being the height of the frame margin.
<iframe src="/some/where" frameborder="0" name="resource" title="Resource" marginheight="10">
A string being the width of the frame margin.
A string that reflects the name HTML attribute, containing a name by which to refer to the frame.
A string that reflects the referrerpolicy HTML attribute indicating which referrer to use when fetching the linked resource.
referrerpolicy
You can use whatever value you want, but the values supported by web browser are:
no-referrer
This means that the Referer HTTP header will not be sent.
Referer
origin
This means that the referrer will be the origin of the page, that is roughly the scheme, the host and the port.
unsafe-url
This means that the referrer will include the origin and the path (but not the fragment, password, or username). This case is unsafe as it can leak path information that has been concealed to third-party by using TLS.
my $iframe = $doc->createElement("iframe"); $iframe->src = '/'; $iframe->referrerPolicy = "unsafe-url"; my $body = $doc->getElementsByTagName('body')[0]; $body->appendChild($iframe); # Fetch the image using the complete URL as the referrer
A TokenList object that reflects the sandbox HTML attribute, indicating extra restrictions on the behavior of the nested content.
Provided with a string (true or false) and this set or gets a string that indicates whether the browser should provide scrollbars for the frame.
true
false
A string that reflects the src HTML attribute, containing the address of the content to be embedded. Note that programmatically removing an <iframe>'s src attribute (e.g. via "emoveAttribute" in HTML::Object::DOM::Element) causes about:blank to be loaded in the frame in Firefox (from version 65), Chromium-based browsers, and Safari/iOS.
my $iframe = $doc->createElement( 'iframe' ); $iframe->src = '/'; my $body = $doc->getElementsByTagName( 'body' )->[0]; $body->appendChild( $iframe ); # Fetch the image using the complete URL as the referrer
In JavaScript environment, this sets a string that represents the content to display in the frame.
var iframe = document.createElement("iframe"); iframe.srcdoc = `<!DOCTYPE html><p>Hello World!</p>`; document.body.appendChild(iframe);
A string that reflects the width HTML attribute, indicating the width of the frame.
Inherits methods from its parent HTML::Object::DOM::Element
Jacques Deguest <jack@deguest.jp>
Mozilla documentation, Mozilla documentation on iframe element
Copyright(c) 2021 DEGUEST Pte. Ltd.
All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install HTML::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTML::Object
CPAN shell
perl -MCPAN -e shell install HTML::Object
For more information on module installation, please visit the detailed CPAN module installation guide.