$('#iframe').ready(function() {
$('#iframe a').attr('target', '_parent');
});
simple as that.
EDIT:
my html:
<div id='outerdiv'>
<iframe src="http://localhost:8888/harvest/blog" id='iframe' scrolling=no></iframe>
</div>
Have you tried using a .load() event instead? See the below question.
To access iframes you need to use 'contents':
$('#iframe').ready(function() {
$('#iframe').contents().find('a').attr('target', '_parent');
});
可能是因为您无法在JavaScript中修改跨域iframe
文档。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.