SketchUp Ruby coding a dialog

Please see this “pinned thread” on how to post code in these forums …

Javascript cannot execute in a vacuum !
It can only be done within the context of a HTML document.
So first you must load a document by either creating a file, or a string of HTML text:

wd = "Point Checker"

htmltext = '<!DOCTYPE html>
    <b>Hello world!</b>


Then AFTER the document is loaded and rendered in the browser frame, you can execute javascript.
(You can also set the document before you show the dialog, but it actually loads when you show it in that case.)

Also the semicolon is misplaced. Ruby does not need semicolons at the end of lines.

I would put the semicolon at the end of the javascript line instead:

wd.execute_script("alert('Hello from Web Dialog');")

UI::WebDialog is deprecated and you should use UI::HtmlDialog if using SketchUp 2017 or higher.