Streaming live at 10am (PST)

Adding code ABOVE the doctype & Sitelok?

Hello everyone,

I’m trying to set up a members area for a clients website and using something called Sitelok, which looks great. But I’m running into niggles and wondered if anyone can help. The website will be published manually btw.

The notes tell me I need to add script ABOVE the doctype - this is an issue to me as I can’t see a way around this bar putting it in after I’ve exported from Webflow. Problem with this is any updated will then overwrite my external script and break the members area.

Is there a way round this I am overlooking?
Thanks in advance
H

You could maybe use javascript to dynamicaly append your code before doctype after your page has loaded.

EDIT:
I believe it is not recommended to inject script before the doctype… since every browser follow a specifc spec order. What about injecting it in the head tag instead ?

Could soemthing like this help ?

(function () {
  let src = "yourscript.js";
  let script = document.createElement("script");
  script.setAttribute("src", src);
  document.head.appendChild(script);
})();