Fetching JSON data in HTML

The short answer is that features get added over time and SketchUp updates the Chromium framework is uses. So, it may be necessary to test for some features.

I did a quick to test in SU2023 at the DevTools Console and it looks as though CEF 88 does recognize window.fetch(). However, there are some CORS security limitations.

SU2024 updated to CEF 112 and Trimble may also have tweaked their edition to relax some of the CORS restrictions for local files.

If you right-click the dialog, open the Chromium DevTools and check the JS Console do you see errors ?


In past versions, I would get the JSON data on the Ruby-side and either stuff it into the HTML or JavaScript code using String#sub! or send it over to the dialog via dialog.execute_script().

But yesterday I was having no success passing a JSON string from SU2024 Ruby to a dialog’s JavaScript environment. I’m not yet sure if this is a bug in the latest edition of SketchUp’s CEF build.

1 Like