admin管理员组文章数量:1026989
How could I show a loading indicator while an iframe is loading a PDF file?
In my partially working solution I do the following: When the modal dialog, where the iframe is in it, is opened then an loading indicator appears. If the content of the iframe is pletely loaded the indicator disappears and the PDF file is shown.
Here is my code:
<div data-gid="<?php echo $gid; ?>" class="modal fade" id="sammelPDF" tabindex="-1" role="dialog" aria-labelledby="sammelPDF" aria-hidden="true">
<div class="modal-dialog" style="width: 1000px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Wettkampfplan gesamt</h4>
</div>
<div class="planGesamtModalBody modal-body">
<div class="rwk-progress" style="display: table; margin: 0 auto;">
<div style="text-align: center;">
<img src="/planung/images/spinner.gif" />
</div>
<p style="margin-top: 10px; text-align: center;">Bitte haben Sie etwas Geduld...</p>
</div>
<iframe width="100%" height="100%" frameborder="0" allowtransparency="true" id="planGesamtPDFFrame" src=""></iframe>
</div>
</div>
</div>
</div>
$('.sammelPDFWettkampfplan').click(function() {
$('.planGesamtPDFFrame').hide();
$('.rwk-progress').show();
});
$('#sammelPDF').on('show.bs.modal', function() {
var group = getActiveTab();
var url = '/pdf?gid=' + $(this).data('gid') + '&classes=1,2,3,4&group=' + group.attr('id') + '&nocache=' + new Date().getTime();
$('#planGesamtPDFFrame').attr('src', url);
});
$('#planGesamtPDFFrame').load(function() {
$('.rwk-progress').hide();
$(this).show();
});
This solution works well in Safari, FF, Chrome and Opera but not in IE. How could I achieve that the loading indicator hides and the PDF is shown in IE?
In Google I found some interesting posts about onreadystatechange
and readyState
but this also doesn't working.
How could I show a loading indicator while an iframe is loading a PDF file?
In my partially working solution I do the following: When the modal dialog, where the iframe is in it, is opened then an loading indicator appears. If the content of the iframe is pletely loaded the indicator disappears and the PDF file is shown.
Here is my code:
<div data-gid="<?php echo $gid; ?>" class="modal fade" id="sammelPDF" tabindex="-1" role="dialog" aria-labelledby="sammelPDF" aria-hidden="true">
<div class="modal-dialog" style="width: 1000px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Wettkampfplan gesamt</h4>
</div>
<div class="planGesamtModalBody modal-body">
<div class="rwk-progress" style="display: table; margin: 0 auto;">
<div style="text-align: center;">
<img src="/planung/images/spinner.gif" />
</div>
<p style="margin-top: 10px; text-align: center;">Bitte haben Sie etwas Geduld...</p>
</div>
<iframe width="100%" height="100%" frameborder="0" allowtransparency="true" id="planGesamtPDFFrame" src=""></iframe>
</div>
</div>
</div>
</div>
$('.sammelPDFWettkampfplan').click(function() {
$('.planGesamtPDFFrame').hide();
$('.rwk-progress').show();
});
$('#sammelPDF').on('show.bs.modal', function() {
var group = getActiveTab();
var url = '/pdf?gid=' + $(this).data('gid') + '&classes=1,2,3,4&group=' + group.attr('id') + '&nocache=' + new Date().getTime();
$('#planGesamtPDFFrame').attr('src', url);
});
$('#planGesamtPDFFrame').load(function() {
$('.rwk-progress').hide();
$(this).show();
});
This solution works well in Safari, FF, Chrome and Opera but not in IE. How could I achieve that the loading indicator hides and the PDF is shown in IE?
In Google I found some interesting posts about onreadystatechange
and readyState
but this also doesn't working.
- 1 possible duplicate of Load event for iFrame not fired in IE – Ben Lesh Commented Oct 3, 2014 at 21:54
-
I have already tried the accepted answer from Load event for iFrame not fired in IE but it seems that the
onload
event-property is fired when the iframe-tag is pletely loaded. Do you have any other ideas? I am really baffled. – Patrick Vogt Commented Oct 3, 2014 at 21:59 - 1 have you tried this stackoverflow./a/6455881/1877909 – Hitesh Commented Oct 3, 2014 at 22:01
- I've just tried your solution but it also doesn't work for me :( – Patrick Vogt Commented Oct 3, 2014 at 22:23
1 Answer
Reset to default 3var iframe = document.createElement("iframe");
iframe.src = "simpleinner.htm";
if (iframe.attachEvent){
iframe.attachEvent("onload", function(){
alert("Local iframe is now loaded.");
});
} else {
iframe.onload = function(){
alert("Local iframe is now loaded.");
};
}
http://www.nczonline/blog/2009/09/15/iframes-onload-and-documentdomain/
How could I show a loading indicator while an iframe is loading a PDF file?
In my partially working solution I do the following: When the modal dialog, where the iframe is in it, is opened then an loading indicator appears. If the content of the iframe is pletely loaded the indicator disappears and the PDF file is shown.
Here is my code:
<div data-gid="<?php echo $gid; ?>" class="modal fade" id="sammelPDF" tabindex="-1" role="dialog" aria-labelledby="sammelPDF" aria-hidden="true">
<div class="modal-dialog" style="width: 1000px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Wettkampfplan gesamt</h4>
</div>
<div class="planGesamtModalBody modal-body">
<div class="rwk-progress" style="display: table; margin: 0 auto;">
<div style="text-align: center;">
<img src="/planung/images/spinner.gif" />
</div>
<p style="margin-top: 10px; text-align: center;">Bitte haben Sie etwas Geduld...</p>
</div>
<iframe width="100%" height="100%" frameborder="0" allowtransparency="true" id="planGesamtPDFFrame" src=""></iframe>
</div>
</div>
</div>
</div>
$('.sammelPDFWettkampfplan').click(function() {
$('.planGesamtPDFFrame').hide();
$('.rwk-progress').show();
});
$('#sammelPDF').on('show.bs.modal', function() {
var group = getActiveTab();
var url = '/pdf?gid=' + $(this).data('gid') + '&classes=1,2,3,4&group=' + group.attr('id') + '&nocache=' + new Date().getTime();
$('#planGesamtPDFFrame').attr('src', url);
});
$('#planGesamtPDFFrame').load(function() {
$('.rwk-progress').hide();
$(this).show();
});
This solution works well in Safari, FF, Chrome and Opera but not in IE. How could I achieve that the loading indicator hides and the PDF is shown in IE?
In Google I found some interesting posts about onreadystatechange
and readyState
but this also doesn't working.
How could I show a loading indicator while an iframe is loading a PDF file?
In my partially working solution I do the following: When the modal dialog, where the iframe is in it, is opened then an loading indicator appears. If the content of the iframe is pletely loaded the indicator disappears and the PDF file is shown.
Here is my code:
<div data-gid="<?php echo $gid; ?>" class="modal fade" id="sammelPDF" tabindex="-1" role="dialog" aria-labelledby="sammelPDF" aria-hidden="true">
<div class="modal-dialog" style="width: 1000px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Wettkampfplan gesamt</h4>
</div>
<div class="planGesamtModalBody modal-body">
<div class="rwk-progress" style="display: table; margin: 0 auto;">
<div style="text-align: center;">
<img src="/planung/images/spinner.gif" />
</div>
<p style="margin-top: 10px; text-align: center;">Bitte haben Sie etwas Geduld...</p>
</div>
<iframe width="100%" height="100%" frameborder="0" allowtransparency="true" id="planGesamtPDFFrame" src=""></iframe>
</div>
</div>
</div>
</div>
$('.sammelPDFWettkampfplan').click(function() {
$('.planGesamtPDFFrame').hide();
$('.rwk-progress').show();
});
$('#sammelPDF').on('show.bs.modal', function() {
var group = getActiveTab();
var url = '/pdf?gid=' + $(this).data('gid') + '&classes=1,2,3,4&group=' + group.attr('id') + '&nocache=' + new Date().getTime();
$('#planGesamtPDFFrame').attr('src', url);
});
$('#planGesamtPDFFrame').load(function() {
$('.rwk-progress').hide();
$(this).show();
});
This solution works well in Safari, FF, Chrome and Opera but not in IE. How could I achieve that the loading indicator hides and the PDF is shown in IE?
In Google I found some interesting posts about onreadystatechange
and readyState
but this also doesn't working.
- 1 possible duplicate of Load event for iFrame not fired in IE – Ben Lesh Commented Oct 3, 2014 at 21:54
-
I have already tried the accepted answer from Load event for iFrame not fired in IE but it seems that the
onload
event-property is fired when the iframe-tag is pletely loaded. Do you have any other ideas? I am really baffled. – Patrick Vogt Commented Oct 3, 2014 at 21:59 - 1 have you tried this stackoverflow./a/6455881/1877909 – Hitesh Commented Oct 3, 2014 at 22:01
- I've just tried your solution but it also doesn't work for me :( – Patrick Vogt Commented Oct 3, 2014 at 22:23
1 Answer
Reset to default 3var iframe = document.createElement("iframe");
iframe.src = "simpleinner.htm";
if (iframe.attachEvent){
iframe.attachEvent("onload", function(){
alert("Local iframe is now loaded.");
});
} else {
iframe.onload = function(){
alert("Local iframe is now loaded.");
};
}
http://www.nczonline/blog/2009/09/15/iframes-onload-and-documentdomain/
本文标签: javascriptHow could I check if an iframe have completely loaded a PDF fileStack Overflow
版权声明:本文标题:javascript - How could I check if an iframe have completely loaded a PDF file - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745561191a2156171.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论