Search code examples
cssepiserver

css removed in epi-server issue - correct to use CDATA?


While having this code:

<link rel="stylesheet" type="text/css" href="externalsite.com/style.css" />

EPi-Server removes this above code when saving.

When having this code:

<![CDATA[
<link rel="stylesheet" type="text/css" href="externalsite.com/style.css" />
//]]>

it seems to work.

Is this a "correct" way of doing this (to use CDATA) ?

UPDATE It didn't actually work. It was left in code, but the css is not applied ):

UPDATE2 In case someone stumples on this issue. use jQuery and add css to head-element (within a document ready).

$('head').append('<link rel="stylesheet" href="http://externalsite.com/style.css" type="text/css" />');

Solution

  • No, CDATA sections are used to exempt data from being parsed as HTML, so you would just be turning the code to visible content.