Issue Details (XML | Word | Printable)

Key: MDL-14541
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Iñaki Arenaza
Reporter: David Boyer
Votes: 4
Watchers: 8
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Object tag embedding PDF's not reliable for Internet Explorer

Created: 24/Apr/08 05:58 PM   Updated: 17/Jul/09 02:21 PM
Return to search
Component/s: Resource
Affects Version/s: 1.8, 1.9
Fix Version/s: 1.8.8, 1.9.4, 2.0

Environment: Windows XP, Internet Explorer 6.0.2600
Issue Links:
Relates
 

Database: Any
Participants: David Boyer, Iñaki Arenaza, Jeff Sherk, Mauno Korpelainen, Nicolas Connault and Tim Lock
Security Level: None
Resolved date: 15/Nov/08
Affected Branches: MOODLE_18_STABLE, MOODLE_19_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE


 Description  « Hide
I've had several reports from users that pages with embedded PDF's aren't displaying the PDF and leave a blank space where it should be. I've managed to trace the issue to the <object> tag.

I've found two fixes that reliably solve the issue for all my users.

1. Switch the <object> tag for an <iframe>, although I understand this isn't valid for the HTML level Moodle wishes to comply with.

2. Add <param name="src" value="' . $fullurl . '" /> within the object tag. I'm not 100% sure if this is valid to the HTML level we want.

A fix or possibly even a configuration to switch the method used would be great.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
David Boyer added a comment - 24/Apr/08 10:52 PM - edited
To update, I tested the following HTML in a valid XHTML Strict document on the W3 validation service. It came back valid so I can't see any issues in that area with adding it in as a fix.

<div class="resourcepdf">
<object data="test.pdf" type="application/pdf">
<param name="src" value="' . $fullurl . '" />Click to open <a href="test.pdf">PDF</a>
</object>
</div>

Edit: Forgot to actually mention which file I've made the change in...

Moodle/mod/resources/type/file/resource.class.php


Jeff Sherk added a comment - 06/May/08 04:54 AM
Internet Explorer does not like the Object tag!!!

I've had similar problems with the Site Policy not displayng in IE, and had to change the Object to IFRAME to get it to work.

Possibly related to this issue... http://tracker.moodle.org/browse/MDL-14609


David Boyer added a comment - 23/Jun/08 06:34 PM
Just to update on this issue, the fix I mentioned above is still working brilliant on my Moodle installation for users.

Any time that I've reverted the code I get several IE users complaining about blank PDFs.


Iñaki Arenaza added a comment - 11/Nov/08 03:18 AM
I can confirm that issue is still present on 1.9.2+ (current as of 3 weeks ago) with IE 6.0 on XP. Adding the line proposed by David Boyer fixes the issue (with no apparent side effects on FF 2.0.x and 3.0.x). We are going to test it with IE 7.0 on XP and Vista to confirm the proposed fix.

Thanks a lot David for your patch! It has saved us from much grief!

Iñaki.


Iñaki Arenaza added a comment - 12/Nov/08 03:27 AM
We have just tested the proposed fix with IE 7.0 on XP and Vista (and also FF 3.0 on Vista) and everything works as expected.

So Nicolas, could you apply the proposed fix? If you are too busy, I can take care of it myself.

Iñaki.


Nicolas Connault added a comment - 12/Nov/08 03:33 AM
Iñaki,

Yes please, that would be very good if you could do it.

Cheers


Mauno Korpelainen added a comment - 12/Nov/08 04:46 AM
Can you check the flash embedding issue too

http://moodle.org/mod/forum/discuss.php?d=110178

You may need to add some other param tags in addition to that pdf tag

<param name="src" value="' . $fullurl . '" />


Mauno Korpelainen added a comment - 12/Nov/08 05:41 AM
Oh, one more note:

this flash embedding problem of file mod/resource/type/file/resource.class.php
does not occur only with IE - it happens with all browsers.

It may happen with other media types too - we just have not tested all types with the latest resource.class.php


Mauno Korpelainen added a comment - 12/Nov/08 05:46 AM
Still most likely the flash embedding problem is related to this pdf issue - and how paths ( $fullurl, $relativeurl etc ) are used in resource.class.php

Mauno Korpelainen added a comment - 14/Nov/08 02:19 PM
The lines that Iñaki added to http://moodle.org/mod/forum/discuss.php?d=110178#p484613 seem to solve also the flash case. Thank you for testing, Iñaki!

Iñaki Arenaza added a comment - 15/Nov/08 09:34 PM - edited
Fixes commited into CVS (1.8, 1.9 and HEAD)

Thanks a lot to David Boyer, Jon Witts and Mauno Korpelainen for helping resolving this issue!

Iñaki.


Tim Lock added a comment - 17/Jul/09 02:21 PM
Same applies to user/policy.php file when using certain versions of IE7 and a PDF in the site policy.

Added this line to the file.

— a/user/policy.php
+++ b/user/policy.php
@@ -45,6 +45,7 @@

echo '<div class="noticebox">';
echo '<object id="policyframe" data="'.$CFG->sitepolicy.'" type="'.$mimetype.'">';
+ echo '<param name="src" value="' . $CFG->sitepolicy . '" />';
// we can not use our popups here, because the url may be arbitrary, see MDL-9823
echo '<a href="'.$CFG->sitepolicy.'" onclick="this.target=\'_blank\'">'.$strpolicyagreementclick.'</a>';
echo '</object></div>';