# Anyway to load custom javascript files before loading kibana UI in the browser?

**URL:** https://discuss.elastic.co/t/anyway-to-load-custom-javascript-files-before-loading-kibana-ui-in-the-browser/324483
**Category:** Kibana
**Tags:** kibana-plugin-development
**Created:** [February 1, 2023, 10:10pm UTC](https://discuss.elastic.co/t/anyway-to-load-custom-javascript-files-before-loading-kibana-ui-in-the-browser/324483 "2023-02-01T22:10:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Joe\_Kuan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_kuan/32/101700_2.png) [@Joe\_Kuan](https://discuss.elastic.co/u/Joe_Kuan)
#### Post date: [February 1, 2023, 10:10pm UTC](https://discuss.elastic.co/t/anyway-to-load-custom-javascript-files-before-loading-kibana-ui-in-the-browser/324483/1 "2023-02-01T22:10:49Z")

</div>

Is there any configurations or method to load custom javascript files before any plugin startup?

Thanks  
Joe

---

<div class="post-metadata">

### Author: ![Ayush\_Mathur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayush_mathur/32/77134_2.png) [@Ayush\_Mathur](https://discuss.elastic.co/u/Ayush_Mathur)
#### Post date: [February 2, 2023, 7:25am UTC](https://discuss.elastic.co/t/anyway-to-load-custom-javascript-files-before-loading-kibana-ui-in-the-browser/324483/2 "2023-02-02T07:25:55Z")

</div>

Hello @Joe_Kuan , yes you can. Essentially in your repo, you can define the steps in your Dockerfile like copying the custom JS or config to your image, running the script and finally starting Kibana.  
I have done something similar in my project, though I was using shell script to be executed before actually starting Kibana and Elasticsearch.  
The skeleton, if you want JS to be executed during image creation, should look something like:

```auto
FROM docker.elastic.co/kibana/kibana:8.6.0
ENV HOME=/opt/app-root/src \
    KBN_PATH_CONF=/usr/share/kibana/config \
    KIBANA_CONF=/usr/share/kibana/config \
    KIBANA_HOME=/usr/share/kibana
USER 0
RUN apt-get install dos2unix
COPY --chown=kibana:kibana install.sh ${HOME}/
RUN dos2unix ${HOME}/*.sh
RUN chmod -R og+x ${HOME}/
RUN ${HOME}/install.sh
USER kibana

```

if it should be executed at runtime:

```auto
FROM docker.elastic.co/kibana/kibana:8.6.0
ENV HOME=/opt/app-root/src \
    KBN_PATH_CONF=/usr/share/kibana/config \
    KIBANA_CONF=/usr/share/kibana/config \
    KIBANA_HOME=/usr/share/kibana
USER 0
RUN apt-get install dos2unix
COPY --chown=kibana:kibana install.sh ${HOME}/
RUN dos2unix ${HOME}/*.sh
RUN chmod -R og+x ${HOME}/
USER kibana
WORKDIR ${HOME}
CMD ["sh", "/opt/app-root/src/install.sh"]

```

---

<div class="post-metadata">

### Author: ![Joe\_Kuan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_kuan/32/101700_2.png) [@Joe\_Kuan](https://discuss.elastic.co/u/Joe_Kuan)
#### Post date: [February 2, 2023, 9:36am UTC](https://discuss.elastic.co/t/anyway-to-load-custom-javascript-files-before-loading-kibana-ui-in-the-browser/324483/3 "2023-02-02T09:36:24Z")

</div>

Thanks for the reply. I apologise for not stating my question clearly.

Actually I was looking for a way to include custom javascript files before loading the kibana UI in the browser. I can create a kibana plugin but that is only started after the core plugins are initiated.

Thanks  
Joe

---

<div class="post-metadata">

### Author: ![Ayush\_Mathur](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayush_mathur/32/77134_2.png) [@Ayush\_Mathur](https://discuss.elastic.co/u/Ayush_Mathur)
#### Post date: [February 2, 2023, 12:01pm UTC](https://discuss.elastic.co/t/anyway-to-load-custom-javascript-files-before-loading-kibana-ui-in-the-browser/324483/4 "2023-02-02T12:01:55Z")

</div>

I can think of one possibility to fork Kibana repo and make your customizations, build the package and image, deploy and run.  
Not sure if there's any other way around to this.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 2, 2023, 12:02pm UTC](https://discuss.elastic.co/t/anyway-to-load-custom-javascript-files-before-loading-kibana-ui-in-the-browser/324483/5 "2023-03-02T12:02:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
