Ticket #857 (closed defect: fixed)
Firefox fails to load in fullpage mode when <link ..> tag in wrong place
|Reported by:||egk10@…||Owned by:||gogo|
|Severity:||normal||Keywords:||firefox, stylesheet, link, fullpage|
I've tested this quite extensively and it only affects Firefox. When editing in FullPage? mode, Firefox fails to initialize the iframe if the page html contains a <link rel="stylesheet" ... /> tag which is not situated at the END of the <head> section (i.e., just before </head>). There is no problem with multiple stylesheets, so long as they are all in a block before </head>. If even one of the <link ... /> tags appears earlier in the header, Firefox fails to initialize the iframe with no error message. IE does not display this problem. The FullPage? plugin is a particular problem here, because it dumps stylesheets in any old place in the header, making the whole document impossible to edit in Firefox.
Solution: re-order all <link ... /> tags on loading the textarea. This can be done by placing the three lines of code below immediately before the doc.write(html); statement in htmlarea.js:
//Fix Firefox problem with link elements not in right place (just before head) var match = html.match(/<link\s+[\s\S]*?["']\s*\/?>/gi); html = html.replace(/<link\s+[\s\S]*?["']\s*\/?>\s*/gi, ''); match ? html = html.replace(/<\/head>/i, match.join('\n') + "\n</head>") : null;