Home  >  Article  >  Web Front-end  >  The page in the iframe to set the attributes of the iframe (width, height)_html/css_WEB-ITnose

The page in the iframe to set the attributes of the iframe (width, height)_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:09:161284browse

a.htm is the page to be nested. There is an iframe in b.htm that nests a.htm
I want to set the width of the iframe in b.htm through js in a.htm. , height

$(parent.window).width(1000);


Due to the same origin policy, the operation encountered an error: permission denied. (not the same domain name)
Is there any way to set b.htm in a.htm? This iframe (an iframe nested in a.htm)?

(Because we want to provide a widget, we give users this code: 0417b0e9989a6339f7257602becfdd2c065276f04003e4622c4fe6b64f465b88, but I want to have less code. I can't use js on the user's page (b.htm), all I can control is a.htm)


Reply to the discussion (solution)

Cross-domain will not work

It involves cross-domain. . . Not easy to handle. .

http://www.chinaz.com/web/2011/1123/222158.shtml
This can completely meet your requirements.

Thank you everyone, I learned a lot of methods.

But I don’t have any control over b.htm (that is, I cannot add any js to b.htm or create files in this directory) , The method I found is to add js to b.htm to change the attributes of iframe

Thank you everyone, I learned a lot of methods.

But I don’t have any control over b.htm (that is, you cannot add any js to b.htm or create files in this directory). The method I found is to add js to b.htm to change the attributes of the iframe
Do not add anything to b, no That’s easy

Statement:
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