That is because you "kill" the document when you do document.write(query). Look at the documentation of document.write.
This works:
@name = "the name" @description = "the description" dialog = UI;;WebDialog.new("Details", true, "sachi_pluginname_dialogname", 410, 875, 1030, 0, true) dialog.add_action_callback("pass_data") { |dialog, htmlpage| js = "set_details(#{@name.inspect}, #{@description.inspect})" # It's not java. dialog.execute_script(js) } dialog.set_file 'C;\Program Files\Google\Google SketchUp 8\Plugins\set_id\details.html' dialog.show() <html> <head> <script> function callRuby(htmlpage) { // Declare the variable with "var" so that it is not global. var query = 'skp;pass_data@' + htmlpage; window.location.href = query; } function set_details(a, b){alert(a); // Example 1 var text = document.createTextNode(a); document.getElementById("detail1").appendChild(text); // Alternative // document.getElementById("detail1").innerHTML = a; // Example 2 document.getElementById("detail2").value = b; } </script> </head> <body> <div id="detail1"></div> <input id="detail2" /> </body> <script> // If you will access element in the page, you need to do this after the page (body) has loaded. callRuby("pull_selection_count"); </script> </html>