Issue with .html file on Box Drive

advice
webdialog

#1

Hey all,

I am getting a strange result when I try to set the path for my web dialog to a file on Box Drive.
I am doing a very simple test request, with the same .html file in two locations

wd = UI::WebDialog.new
wd.set_file path
wd.show

When path = File.join(‘C:’,‘Users’,‘Developer’,‘Documents’,‘chatterbox.html’) The page opens in the dialog just fine.
When path = File.join(‘C:’,‘Users’,‘Developer’,‘Box’,‘chatterbox.html’) I get a totally blank web dialog.

I have tested changing the html file name to one that does not exist, and I get a '‘Navigation error’ page (so I’m sure I’m not just referencing the wrong location)

My (very simple) HTML is below

Chatterbox Here!

Say Hi! Say Bye!

#2

you can check if the file is readable

File.world_readable?(path)           #=> 420
# or
m = File.world_readable?(path)
sprintf("%o", m)    

if it returns nil you have permission issues on the folder…

john


#3

… is very inefficient.

File::SEPARATOR (which File::join uses) is ‘/’ on both platforms.

I’d use ENV["HOME"] instead, coupled with a folder var:

path = File::join( 'file:///', ENV["HOME"], folder, 'chatterbox.html' )

Also you can set (or reset) the html page after the dialog frame is displayed.


FYI, WebDialog class is deprecated, and has some security quirks when trying to load files from the local machine. (I think SketchUp API copies the webpage to the TEMP folder, and actually loads it from there.)

or:


#6

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.