First look at the example:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml"> <pead> <meta http-equiv =" content-Type "content =" text/html; charset = UTF-8 "/> <title> www.www.jb51.net </title> </pead> <body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
In this section, ifr. src is put after append and runs. The surface is nothing, and it seems to be normal. However, if you use the packet capture tool, you will find that when you refresh (F5 or refresh button), there will be an additional request:
00:00:04. 671 0.021 * GET Aborted text/html http://www.baidu.com/
Although the status is Aborted, this request is still sent to the server!
What if I put ifr. src before append? This problem is gone!
Similar:
Put ifr. frameBorder = 0 after append, the iframe can still be viewed as the border. Put it before append, and the border is 0.
Put ifr. scrolling = "no" after append, it does not work. put it before append.
Ifr. width and ifr. height are not affected either before or after placement.
However, if you want to add a temporary parameter to the iframe address to request a new page every time. src cannot be placed before append (when refreshing or F5 )!
Such as code:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml"> <pead> <meta http-equiv =" content-Type "content =" text/html; charset = UTF-8 "/> <title> www.www.jb51.net </title> </pead> <body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh to execute] You can monitor that every time you refresh, The tmp is the same value! Unless you reload (not F5/refresh ).
What about the alternative method? Use document. write to implement? I can tell you, either!