Home > Web Front-end > JS Tutorial > Dynamically generated IFRAME, problem solving analysis when setting SRC_javascript skills

Dynamically generated IFRAME, problem solving analysis when setting SRC_javascript skills

WBOY
Release: 2016-05-16 19:05:20
Original
1599 people have browsed it

Let’s look at the example first:


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]


This section, After ifr.src is placed in append, it runs. There is nothing on the surface and it seems normal. But if you use the packet capture tool to take a look, you will find that when refreshing (F5 or refresh button), there will be one more 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 you put ifr.src before append? This problem is gone!

Similar ones include:
Put ifr.frameBorder = 0 after append, this iframe can still see the border. Before putting it in append, the border is 0.
If you put ifr.scrolling = "no" after append, it will not work. If you put it before append, it will work.
Ifr.width and ifr.height have no effect whether they are placed in front or behind.


However, if you want to add a temporary parameter after the iframe address to achieve the effect of requesting a new page every time, putting ifr.src before append will not work (refresh or F5)!

Such as code:

[Ctrl A Select all Note:
If you need to introduce external Js, you need to refresh to execute
]

You can monitor it, every When refreshed, that tmp is the same value! Unless you reload (not F5/Refresh). What about another method? Use document.write to achieve? I can tell you, it doesn’t work either!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template