How to make a good iframe, detailed analysis of each attribute of iframe, personal opinion

As a bridge for interaction between websites, iframe is loved by many webmasters, but there are insecure factors, so it is very important to fill in the attributes correctly.



<iframe name="my_iframe" height="540" width="100%"
       frameborder="0" marginwidth="0" marginheight="0" scrolling="no" border="0"
       src=" http:// www.33xyx.com/ " security="restricted"
       sandbox="allow-forms allow-scripts allow-same-origin">





Attribute analysis:

1. No need to introduce name id, it is to apply and operate iframe through keywords

2, height width is to define the width and height of the iframe, there are numbers or percentages

3, whether the frameborder displays a border 1 or 0

4, marginheight marginwidth defines the margin from the top to the bottom of the iframe, the margin from the left to the right is

5, whether the scrolling iframe can scroll

6, src =" http://www.33xyx.com/ "

7, security="restricted" I understand that the iframe thing can't control the parent page's things, some people will use top.location.href="" to control the jump, so you need to measure whether you need to add

8, sandbox="allow- forms allow-scripts allow-same-origin" uses the iframe as a sandbox mode, allowing those permissions, I am allowing him to submit forms and scripts to execute and operate with the same origin. The last two attributes are more important, and it is best to understand them in the book.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326612615&siteId=291194637