Opened 15 years ago

Closed 14 years ago

#75 closed defect (wontfix)

(Interim Solution): Including external style sheet doesn't work with IE

Reported by: webmaster@… Owned by: gogo
Priority: high Milestone:
Component: Xinha Core Version:
Severity: normal Keywords:
Cc:

Description

When explicitly giving Xinha an external stylesheet:
this.pageStyle = '@import url(/htmlarea/screen.css);';
it is correctly displayed in Firefox, but not in IE (standard style instead).
With htmlArea3, it was the other way around.
Tried
this.pageStyleSheets.push('/htmlarea/screen.css');
but that didn't work in either browser.
I don't know the version number. Was the latest nightly a couple of days ago ;-)

Change History (4)

comment:1 Changed 15 years ago by Geoffrey Kantaris <egk10@…>

  • Priority changed from normal to high

I have the same problem with nightly downloaded 20th March 2005 on IE WinXP. I've tried every setting I can think of (in e.g. cssPath is set to absolute ref):

xinha_config.pageStyle = "@import url(" + cssPath + ");";
xinha_config.pageStyleSheets = [ cssPath ];
xinha_config.pageStyleSheets.push('cssPath'); -- with and without single quotes

and (with i set to sub-variable of xinha_editors):

xinha_editors[i].config.pageStyle = "@import url(" + cssPath + ");";

etc. as above

It used to work fine in old htmlarea.

comment:2 Changed 15 years ago by Geoffrey Kantaris <egk10@…>

  • Summary changed from Including external style sheet doesn't work with IE to (Interim Solution): Including external style sheet doesn't work with IE

I have an interim solution which works for me. In xinha_init, after the line which sets up the configuration:

xinha_config = xinha_config ? xinha_config : new HTMLArea.Config();

we can use the following:

xinha_config.pageStyle = HTMLArea._geturlcontent('/myStyles.css');

where /myStyles.css is the absolute reference to your stylesheet. You could also make this reference a variable and set it at the beginning of the init routine, for ease of customization.

I see this as an interim solution because it relies on the hack of reading all the styles from the stylesheet and writing them directly into the iframe header's <style> section. Ultimately, HTMLArea.prototype.initIframe should be altered to do this internally for whatever is stored in config.pageStyleSheets if there is no other solution.

comment:3 Changed 14 years ago by egk10@…

A further solution is to *fully specify* the location of the stylesheet INCLUDING THE PROTOCOL. Hence the following works in IE (note the square brackets, because Xinha expects an array of stylesheets):

   xinha_config.pageStyleSheets = ['http://www.mysite.com/userstyles/mystyles.css'];

and the following DOES NOT WORK in IE:

xinha_config.pageStyleSheets = ['/userstyles/mystyles.css'];

Similarly, with Stylist, the correct syntax would be:

  xinha_config.stylistLoadStylesheet('http://www.mysite.com/userstyles/mystyles.css', {
    '.selector1' : 'Description',
    '.selector2' : 'Descritpion2'
  });

comment:4 Changed 14 years ago by gogo

  • Resolution set to wontfix
  • Status changed from new to closed

A further solution is to *fully specify* the location of the stylesheet INCLUDING THE PROTOCOL. Hence the following works in IE (note the square brackets, because Xinha expects an array of stylesheets):

Indeed, this is the correct method, I believe it is even mentioned somewhere. The trouble with not using fully resolved URLs is that the iframe doesn't have a set location to resolve partial URLs against.

Closing WONTFIX.

Note: See TracTickets for help on using tickets.