I need to use fonts from Typekit in my Wix website. I understand that Wix doesn’t allow allow any CSS alterations but you can add Javascript - presumably therefore it is possible to add the Typekit code in this way (as Typekit provides both CSS and Javascript code)? Could anyone please explain how to do this (I have limited experience of CSS and HTML but am not au fait with coding), I haven’t found anything that explains or even confirms if this is possible.
Hi Rachel,
Welcome to the Wix Code forums.
WixCode understands all of Javascript, except for anything that accesses the DOM.
This keeps the user from inadvertently “breaking” something. I myself tried to hack things from the code, from an iFrame, and in my dreams, but WixCode wasn’t having any of it.
Accessing document elements such as div, span, button, etc is off-limits. The way to access elements on the page is only through $w.
One small exception is the $w.HtmlComponent (which is based on an iFrame). This element was designed to contain vanilla HTML and it works just fine. You just can’t try to trick it by using parent, window, top, etc. Same goes with the Javascript evaluate() function. It is sandboxed and does not allow access to the DOM.
Therefore, even though Wix Code does allow Javascript, it is limited and strictly sandboxed and won’t allow Typekit the access you need to add the fonts you want.
Feel free to post a Feature Request . The development team pays careful attention to user comments and feedback.
Yisrael
You can vote for this feature here: https://support.wix.com/en/article/wix-editor-request-integrating-the-adobe-typekit-into-the-wix-editor