how to access iFrame parent page using jquery?
To find in the parent of the iFrame use: $(‘#parentPrice’, window.parent.document).html(); The second parameter for the $() wrapper is the context in which to search. This defaults to document.
To find in the parent of the iFrame use: $(‘#parentPrice’, window.parent.document).html(); The second parameter for the $() wrapper is the context in which to search. This defaults to document.
Add display:block; to your iframe css. div, iframe { width: 100px; height: 50px; margin: 0 auto; background-color: #777; } iframe { display: block; border-style:none; } <div>div</div> <iframe src=”https://stackoverflow.com/questions/8366957/data:,iframe”></iframe>
document.getElementById(‘some_frame_id’).contentWindow.location.reload(); be careful, in Firefox, window.frames[] cannot be indexed by id, but by name or index
var iframe = document.getElementById(‘iframeId’); var innerDoc = (iframe.contentDocument) ? iframe.contentDocument : iframe.contentWindow.document; You could more simply write: var iframe = document.getElementById(‘iframeId’); var innerDoc = iframe.contentDocument || iframe.contentWindow.document; and the first valid inner doc will be returned. Once you get the inner doc, you can just access its internals the same way as you would access … Read more
Depends what you mean by “post data”. You can use the HTML target=”” attribute on a <form /> tag, so it could be as simple as: <form action=”do_stuff.aspx” method=”post” target=”my_iframe”> <input type=”submit” value=”Do Stuff!”> </form> <!– when the form is submitted, the server response will appear in this iframe –> <iframe name=”my_iframe” src=”https://stackoverflow.com/questions/168455/not_submitted_yet.aspx”></iframe> If that’s … Read more
As with all technologies, it has its ups and downs. If you are using an iframe to get around a properly developed site, then of course it is bad practice. However sometimes an iframe is acceptable. One of the main problems with an iframe has to do with bookmarks and navigation. If you are using … Read more
You could use frameset as the previous answer states but if you are insistent on using iFrames, the 2 following examples should work: <body style=”margin:0px;padding:0px;overflow:hidden”> <iframe src=”http://www.youraddress.com” frameborder=”0″ style=”overflow:hidden;height:100%;width:100%” height=”100%” width=”100%”></iframe> </body> An alternative: <body style=”margin:0px;padding:0px;overflow:hidden”> <iframe src=”http://www.youraddress.com” frameborder=”0″ style=”overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;position:absolute;top:0px;left:0px;right:0px;bottom:0px” height=”100%” width=”100%”></iframe> </body> To hide scrolling with 2 alternatives as shown above: <body style=”margin:0px;padding:0px;overflow:hidden”> <iframe … Read more
<a onclick=”parent.abc();” href=”#” >Call Me </a> See window.parent Returns a reference to the parent of the current window or subframe. If a window does not have a parent, its parent property is a reference to itself. When a window is loaded in an <iframe>, <object>, or <frame>, its parent is the window with the element … Read more
You need JavaScript. It is the same as doing it in the parent page, except you must prefix your JavaScript command with the name of the iframe. Remember, the same origin policy applies, so you can only do this to an iframe element which is coming from your own server. I use the Prototype framework … Read more
Update in 2019 TL;DR: Today the best option is – flexbox. Everything supports it nicely and has for years. Go for that and don’t look back. Here is a code sample for flexbox: body, html {width: 100%; height: 100%; margin: 0; padding: 0} .row-container {display: flex; width: 100%; height: 100%; flex-direction: column; background-color: blue; overflow: … Read more