This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Dor Karavani
Posted May 16 - Read on Facebook

What is wrong with the following JS ? why do I get an error ?

<script type="text/javascript">// <![CDATA[
window.DY = window.DY || {}; DY.recommendationContext = {type: "PRODUCT", data: ['SKU123']};]]></script>


Nathan Krischer

What is the <![CDATA[...]]> you have around everything? You're doing assignments inside bracket notation. Also those < > you have around it are invalid JS. You've got quite a few errors and invalid JS. You're also negating the whole thing coercing it to a boolean value. I also can't tell what is supposed to be commented out as Facebook removed the newlines. Where did you find it?

Dor Karavani

the first code

Nathan Krischer

Your link just goes to a login page.

Dor Karavani
Nathan Krischer

Look at their code then at yours. Whatever this <![CDATA[..]]> is it's all commented out, but in yours you did not comment out the last part. It look like you have <![CDATA[ commented out but not ]]> which is invalid JS.

Carl Mathisen

Nathan, CDATA is indeed valid. It's just legacy for use in XML/XHTML documents which most people don't use these days. You are right though, Dor should comment out the last ]]> part for it to work. Or better yet, just remove CDATA if his document doesn't use XHTML as doctype.

Read the entire post on Facebook