# Js referencing builder 404 link on live site (but not draft)

**URL:** <https://forum.builder.io/t/js-referencing-builder-404-link-on-live-site-but-not-draft/1420>\
**Category:** Bugs\
**Tags:** visual-editor, shopify\
**Created:** [December 4, 2021, 6:49pm UTC](https://forum.builder.io/t/js-referencing-builder-404-link-on-live-site-but-not-draft/1420 "2021-12-04T18:49:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Doortender](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@Doortender](https://forum.builder.io/u/Doortender)\
**Post date:** [December 4, 2021, 6:49pm UTC](https://forum.builder.io/t/js-referencing-builder-404-link-on-live-site-but-not-draft/1420/1 "2021-12-04T18:49:26Z")

</div>

Hi,

This feels like a bug to me.

I’m using a custom code object within a box. There’s some javascript in a script tag that I’m testing.  
Everything works as intended in the editor however when I publish it, the builder object returns a 404.

I created a short video as well as **the console from the builder editor.**  
It appears the error exists in the editor as well, but it runs correctly in my browser so it doesn’t return an error?

Am I understanding how this should integrate?

(PS I’m not a developer, just someone who knows a tiny bit of code so I apologize in advance if this is naive or not enough detail)

Thanks in advance,

* * *

**Builder content link**

> **[Builder.io: Drag and drop page builder and CMS](https://builder.io/content/15651ebd9b14460ca20ebbe08f51ac84)**
>
> Build and optimize digital experiences for any tech stack, visually.

**Builder public api key**  
4d74977563e44093958fcbdf0acb9d10

**Detailed steps to reproduce the bug**  
See video

**Screenshots or video link**

[https://dl.dropboxusercontent.com/s/mr2koyv71b92h1u/Builder.io\_%20Drag%20and%20drop%20page%20builder%20and%20CMS%20-%20Google%20Chrome%202021-12-04%2011-16-28.mp4?dl=0](https://dl.dropboxusercontent.com/s/mr2koyv71b92h1u/Builder.io_%20Drag%20and%20drop%20page%20builder%20and%20CMS%20-%20Google%20Chrome%202021-12-04%2011-16-28.mp4?dl=0)

**Code stack you are integrating Builder with**  
Shopify

**Reproducible code example**  
[![](https://us1.discourse-cdn.com/flex020/uploads/builder/original/1X/5263015b16eda5b850457331f574a46f17139a36.jpeg) ](https://dl.dropboxusercontent.com/s/6wtvf5314jcznrs/Code_Output_from_builder_editor.JPG?dl=0)

---

<div class="post-metadata">

**Author:** ![maddy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/maddy/32/11_2.png) [@maddy](https://forum.builder.io/u/maddy)\
**Post date:** [December 6, 2021, 7:57pm UTC](https://forum.builder.io/t/js-referencing-builder-404-link-on-live-site-but-not-draft/1420/2 "2021-12-06T19:57:21Z")

</div>

Hi @Doortender!

Can you try either: 1) Adding a binding to the custom code block in the data tab to `showIf Builder.isBrowser` or 2) Move the JS from the custom code block to the content JS section in the data tab (within `Builder.isBrowser`). Let me know if this works! We also have a countdown template that you could use rather than the custom code block.

---

<div class="post-metadata">

**Author:** ![Doortender](https://avatars.discourse-cdn.com/v4/letter/d/53a042/32.png) [@Doortender](https://forum.builder.io/u/Doortender)\
**Post date:** [December 10, 2021, 3:04am UTC](https://forum.builder.io/t/js-referencing-builder-404-link-on-live-site-but-not-draft/1420/3 "2021-12-10T03:04:32Z")

</div>

Hi Maddy,

Thanks for your response. Your suggestion worked (#1).

Just for my understanding, custom code blocks run server side but don’t reference an output unless it’s explicitly telling it it’s in a browser?

Is the main use of the custom code block to just run js logic?

Am I understanding that correctly?

Thanks,

David

(PS. I didn’t use the countdown template because I couldn’t figure out how to make it time relative to today’s date.)

---

<div class="post-metadata">

**Author:** ![maddy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.builder.io/maddy/32/11_2.png) [@maddy](https://forum.builder.io/u/maddy)\
**Post date:** [December 10, 2021, 7:54pm UTC](https://forum.builder.io/t/js-referencing-builder-404-link-on-live-site-but-not-draft/1420/4 "2021-12-10T19:54:17Z")

</div>

Glad that worked! Custom code blocks will be run on the server, depending on the advanced options selected. If the custom code is doing something in the dom, you’ll want to do this only in the browser. Using a custom code block shouldn’t be the first option (instead you should try and use Builder’s built-in blocks), but if you have to use a custom code block, yes, JS or 3rd party code are main use cases.
