Describe the bug
There are two strange problems with the displaying web view in the floating menu. When I try to set the location of the HTML file, which is inside the preset folder, using the presetfile:// path, the page doesn't seem to load at all. However, when I use the path from the localfile://, instead of displaying the website, the HTML file is shown as plain text.
Interestingly, everything displays correctly when I call the old type of Floating Web View from the Actions level, but only when I use Web URL or path to local HTML file to show in floating Web View setting with BTT_PRESET_PATH/settings.html in input.
Exactly that is what I did, and only the file content appears as text, just like in the second screenshot.
Here, I did exactly as you wrote. I tested both forms, and unfortunately, it still doesn't work.
What is even more interesting is that I have the impression the problem lies with the HTML file itself. If you allow me, I will send you this in a private message. Why? Because when I tried with a different HTML file, there was absolutely no problem and everything worked as it should. When I paste the content of the file that doesn’t work directly into the HTML or URL field, it displays site correctly. However, some variables from BetterTouchTool do not load.
The problem was solved. It turns out that the floating menu was in the correct present, but the WebView in the floating menu was in a default one. I didn’t notice this because they were the same color.
Thank you very much for your help with this issue, but another problem has arisen in the process. The same file, which works perfectly using the old Floating Web View, no longer accepts BetterTouchTool scripts here. I see the following error appearing in the console:
[Error] Origin presetfile://settings.html is not allowed by Access-Control-Allow-Origin. Status code: 200
[Error] Failed to load resource: Origin presetfile://settings.html is not allowed by Access-Control-Allow-Origin. Status code: 200 (get_string_variable, line 0)
[Error] Fetch API cannot load bttweb://get_string_variable/?variable_name=reminder due to access control checks.
ah your script is called before the webview is initialized. There are two ways to solve his:
1.) only call your script function after a small delay
2.) or add this function to your html and only call further scripts after that has been triggered:
/* This is called after the webview content has loaded*/
function BTTInitialize() {
}
BTTDraggable not working is also pretty weird, as it's also the same webview (and code) as in the old show webview action (I just confirmed that it works ok here). I wonder what might be going on.
The problem has been solved. Regarding the script loading, I did have to add a slight delay for it to work because simply adding this function before the rest of the script didn’t work. As for BTTDraggable, I don’t know what I did, but suddenly, it started working.