Skip to content

Commit

Permalink
MDL-29444 use iframe embedding in IE
Browse files Browse the repository at this point in the history
iframe is back in HTML 5, we can safely use it in IE for all text documents because object embedding has multiple problems
  • Loading branch information
skodak committed Oct 23, 2011
1 parent 3a81b37 commit 3df93d6
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/resourcelib.php
Expand Up @@ -477,6 +477,7 @@ function resourcelib_embed_pdf($fullurl, $title, $clicktoopen) {
* @param string $fullurl
* @param string $title
* @param string $clicktoopen
* @param string $mimetype
* @return string html
*/
function resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype) {
Expand All @@ -490,17 +491,11 @@ function resourcelib_embed_general($fullurl, $title, $clicktoopen, $mimetype) {

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

// IE can not embed stuff properly if stored on different server
// that is why we use iframe instead, unfortunately this tag does not validate
// in xhtml strict mode
// IE can not embed stuff properly, that is why we use iframe instead.
// Unfortunately this tag does not validate in xhtml strict mode,
// but in any case it is undeprecated in HTML 5 - we will use it everywhere soon!
if ($mimetype === 'text/html' and check_browser_version('MSIE', 5)) {
// The param tag needs to be removed to avoid trouble in IE.
$param = '';
if (preg_match('(^https?://[^/]*)', $fullurl, $matches)) {
if (strpos($CFG->wwwroot, $matches[0]) !== 0) {
$iframe = true;
}
}
$iframe = true;
}

if ($iframe) {
Expand Down

0 comments on commit 3df93d6

Please sign in to comment.