# How to load JS and CSS files in floating webview

**URL:** <https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376>\
**Category:** Floating Menus / Widgets\
**Tags:** floating-web-view\
**Created:** [February 27, 2026, 6:11pm UTC](https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376 "2026-02-27T18:11:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![somelinguist](https://community.folivora.ai/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@somelinguist](https://community.folivora.ai/u/somelinguist)\
**Post date:** [February 27, 2026, 6:11pm UTC](https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376/1 "2026-02-27T18:11:56Z")

</div>

Is it possible to load javascript and css files in a floating webview from an html file in the preset directory?

```xml
<script type="module" src="presetfile://assets/index-CNsiR_dp.js"></script>
<link rel="stylesheet" href="presetfile://assets/index-DG9j6O4a.css">

```

I have all the files in the preset directory, and it seems to find them (if I change the path in the href’s above, it says it can’t find them).

However, I’m not sure it actually loads them. When I use the inspector, it shows the file names, but the contents appear blank, and the script doesn’t seem to do anything.

 ![Screenshot 2026-02-27 at 12.10.01 PM](https://community.folivora.ai/uploads/default/original/3X/7/2/72cf125375e11465907ea9fb74f5ca72321e506c.png)

Am I missing something.

Thanks!

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [February 27, 2026, 7:40pm UTC](https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376/2 "2026-02-27T19:40:20Z")

</div>

due to some webview limitations this only works if the HTML is also placed in the presets folder and referenced like this:

 ![image](https://community.folivora.ai/uploads/default/original/3X/1/9/194069a68f875962b79fe8859e9f73de2651f9b8.jpeg)

//edit: note, if you are trying this with BTT Mobile you need to include the preset name in the link like this: presetfile://presetname/filename.html

---

<div class="post-metadata">

**Author:** ![somelinguist](https://community.folivora.ai/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@somelinguist](https://community.folivora.ai/u/somelinguist)\
**Post date:** [February 27, 2026, 8:01pm UTC](https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376/3 "2026-02-27T20:01:06Z")

</div>

Thanks.

I was trying to load it via a Show Floating WebView action like this:

 ![Screenshot 2026-02-27 at 1.53.17 PM](https://community.folivora.ai/uploads/default/original/3X/6/6/664befd61d42fe59fedfba9b6ce56e7dd53e79d1.png)

Is that possible?

I did just try using through a Floating Menu with a WebView/HTML Item as you suggested. But that gives the following error in the Inspector Console logs

```auto
Origin presetfile://index.html is not allowed by Access-Control-Allow-Origin. Status code: 200

Failed to load resource: Origin presetfile://index.html is not allowed by Access-Control-Allow-Origin. Status code: 200 presetfile://assets/index-CNsiR_dp.js

```

When using the Show Floating WebView action, there’s no error, but doesn’t seem to load the JS and CSS files either.

All of the files are in the preset directory.

---

<div class="post-metadata">

**Author:** ![somelinguist](https://community.folivora.ai/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@somelinguist](https://community.folivora.ai/u/somelinguist)\
**Post date:** [February 27, 2026, 8:06pm UTC](https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376/4 "2026-02-27T20:06:25Z")

</div>

> [@Andreas\_Hegenberg](#):
>
> //edit: note, if you are trying this with BTT Mobile you need to include the preset name in the link like this: presetfile://presetname/filename.html

Right now I’m just on the Mac

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [February 27, 2026, 8:16pm UTC](https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376/5 "2026-02-27T20:16:30Z")

</div>

It seems to work fine here, however there seem to be multiple developers facing the issue you described. Behavior seems to differ a lot between macOS versions. I have added a suggested workaround in 6.219 which is uploading now!

---

<div class="post-metadata">

**Author:** ![somelinguist](https://community.folivora.ai/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@somelinguist](https://community.folivora.ai/u/somelinguist)\
**Post date:** [February 27, 2026, 8:17pm UTC](https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376/6 "2026-02-27T20:17:29Z")

</div>

Thanks. I’ll try the next build.

I’m still macOS 15.7.4.

---

<div class="post-metadata">

**Author:** ![somelinguist](https://community.folivora.ai/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@somelinguist](https://community.folivora.ai/u/somelinguist)\
**Post date:** [February 27, 2026, 8:37pm UTC](https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376/7 "2026-02-27T20:37:00Z")

</div>

6.219 did away with the cross-origin error, but it still doesn’t seem to be actually loading the CSS or JS files using either the Floating Menu Web Item or the Show Floating WebView action.

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [February 27, 2026, 8:42pm UTC](https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376/8 "2026-02-27T20:42:38Z")

</div>

that's strange, could you share some example file?

I just tried with

body { background: red;}

which immediately turned the webview red

You are sure the files are in the correct preset's folder? (needs to be in the folder for the trigger's preset - unless you specify the preset name in the path)

Possibly try without the assets subfolder.

---

<div class="post-metadata">

**Author:** ![somelinguist](https://community.folivora.ai/letter_avatar_proxy/v4/letter/s/73ab20/32.png) [@somelinguist](https://community.folivora.ai/u/somelinguist)\
**Post date:** [February 27, 2026, 8:50pm UTC](https://community.folivora.ai/t/how-to-load-js-and-css-files-in-floating-webview/46376/9 "2026-02-27T20:50:37Z")

</div>

I had just finished trying moving it out of the assets folder when I saw you edited post.

It works fine when they’re not in a subfolder, but directly in the preset folder.

Both for the Floating Menu Web Item or the Show Floating WebView action.
