简体   繁体   中英

How do I modify an iframe using CGI in Perl?

So I have figured out how to "create" an iFrame using cgi, but I have no idea how to manipulate it (ie change size, change source, disable scrolling, etc). This is what I have written in Perl:

    #!/usr/bin/perl

    use strict;
    use warnings;
    use CGI;

    my $page = new CGI;


    print $page->header;
    print $page->start_html;
    print $page->iframe("http://www.nasa.gov/");
    print $page->end_html;

But here is the HTML I receive:

    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"><head><title>Untitled Document</title>
    </head><body><iframe>http://www.nasa.gov/</iframe></body></html>

Of course, when adding the source and size attributes, the info must go inside of the > symbol, like so:

<iframe src="http://www.nasa.gov/"> Enter Text Here </iframe>

Instead, CGI closes the iframe header, like so:

<iframe>http://www.nasa.gov/</iframe>

How am I supposed to modify the iframe in this case? Can it be done?

 print $page->iframe({src => "http://www.nasa.gov/"}, "");

您需要将地址放入src属性,而不是iframe内容(这是不支持该元素的浏览器的后备内容 - 主要是理论上的功能)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM