Chrome Embedded Framework detection

Hello, I use Class: UI::HtmlDialog to open my webapp that can be openned by non-embedded navigator. Do you know, if there a server-side way to know if my web app is running in the sketchup Chrome Embedded Framework. Thx

Yes, in a SketchUp CEF window, there will be injected the sketchup JS object. So …

if (typeof sketchup === 'object') {
  // the webapp is running inside a SketchUp UI::HtmlDialog window ...
}

You can also parse the user agent string.

For example use this CEF version dialog to see what the user agent string is inside SketchUp …

ChromiumVersionDialog.rb (2.5 KB)

… you’ll see a “SketchUp” token is inserted into the string. This will not be present if the webapp is running in a standalone browser.

It works like a charm. Thx

1 Like