Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-14541

Object tag embedding PDF's not reliable for Internet Explorer

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.8, 1.9
    • Fix Version/s: 1.8.8, 1.9.4, 2.0
    • Component/s: Resource
    • Labels:
      None
    • Environment:
      Windows XP, Internet Explorer 6.0.2600
    • Database:
      Any
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      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.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            daibach David Boyer added a comment - - 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

            Show
            daibach David Boyer added a comment - - 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
            Hide
            jsherk Jeff Sherk added a comment -

            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

            Show
            jsherk Jeff Sherk added a comment - 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
            Hide
            daibach David Boyer added a comment -

            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.

            Show
            daibach David Boyer added a comment - 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.
            Hide
            iarenaza Iñaki Arenaza added a comment -

            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.

            Show
            iarenaza Iñaki Arenaza added a comment - 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.
            Hide
            iarenaza Iñaki Arenaza added a comment -

            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.

            Show
            iarenaza Iñaki Arenaza added a comment - 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.
            Hide
            nicolasconnault Nicolas Connault added a comment -

            Iñaki,

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

            Cheers

            Show
            nicolasconnault Nicolas Connault added a comment - Iñaki, Yes please, that would be very good if you could do it. Cheers
            Hide
            korpelainen Mauno Korpelainen added a comment -

            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 . '" />

            Show
            korpelainen Mauno Korpelainen added a comment - 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 . '" />
            Hide
            korpelainen Mauno Korpelainen added a comment -

            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

            Show
            korpelainen Mauno Korpelainen added a comment - 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
            Hide
            korpelainen Mauno Korpelainen added a comment -

            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

            Show
            korpelainen Mauno Korpelainen added a comment - 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
            Hide
            korpelainen Mauno Korpelainen added a comment -

            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!

            Show
            korpelainen Mauno Korpelainen added a comment - 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!
            Hide
            iarenaza Iñaki Arenaza added a comment - - 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.

            Show
            iarenaza Iñaki Arenaza added a comment - - 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.
            Hide
            tlock Tim Lock added a comment -

            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>';

            Show
            tlock Tim Lock added a comment - 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>';
            Hide
            andyjdavis Andrew Davis added a comment -

            The file this fix was in appears to have been removed in the time since this bug was fixed. The replacement code isn't putting anything like
            <param name="src" value="' . $fullurl . '" />
            inside the object tag. Not sure why this was removed however I am able to view embedded pdfs in IE 6, 7 and 8. Closing.

            Show
            andyjdavis Andrew Davis added a comment - The file this fix was in appears to have been removed in the time since this bug was fixed. The replacement code isn't putting anything like <param name="src" value="' . $fullurl . '" /> inside the object tag. Not sure why this was removed however I am able to view embedded pdfs in IE 6, 7 and 8. Closing.

              People

              • Votes:
                4 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  28/Jan/09