MDL-77646 lib: Use iframe instead of object to display pdf.

This commit is contained in:
Derek Henderson 2024-11-19 18:07:06 +01:00 committed by Luca Bösch
parent 2f82f5fe8c
commit 06f256fd60

View File

@ -233,13 +233,12 @@ function resourcelib_embed_pdf($fullurl, $title, $clicktoopen) {
global $CFG, $PAGE;
$code = <<<EOT
<div class="resourcecontent resourcepdf">
<object id="resourceobject" data="$fullurl" type="application/pdf" width="800" height="600">
<param name="src" value="$fullurl" />
$clicktoopen
</object>
</div>
EOT;
<div class="resourcecontent resourcepdf">
<iframe id="resourceobject" src="$fullurl" title="$title" width="800" height="600">
$clicktoopen
</iframe>
</div>
EOT;
// the size is hardcoded in the boject obove intentionally because it is adjusted by the following function on-the-fly
$PAGE->requires->js_init_call('M.util.init_maximised_embed', array('resourceobject'), true);