Enable error reporting for WebDialogs under OSX?
-
I'm running into some problems with WebDialogs under OSX. Seems that I might get some JavaScript error, but I never get any error message. I suspect it might be suppressed. Any way to enable it?
-
maybe this guy knows?
http://forums.sketchucation.com/viewtopic.php?f=180&t=32332
(though i'm not sure if you two are even talking about something similar )
-
It appears to be related to
.set_html
vs.set_file
.If I use
.set_file
everything works fine.
But if I read the content of that same HTML file into a string and pass it to.set_html
, then I get just plain HTML. No CSS or images.And I used FULL path for all resources!
-
Under Windows when I use
.set_html
,document.location
returns the path to a temp file SU created with the HTML string.
Under OSXdocument.location
returnsabout:blank
.Seems I have to write out my own temp file. I still don't understand what's wrong, as the HTML content loads and I use full paths. Works under Windows. But .set_html simply refuses to load external files in the HTML - when though using .set_file with the same HTML content works fine.
-
it seems logic to me and looks like Windows implementation has the "bug" - set_html just sets the html code and there is no location available
it is the same as when loading a file in ruby with eval and there is no error info regarding the file -
@unknownuser said:
it seems logic to me and looks like Windows implementation has the "bug" - set_html just sets the html code
What's logical? I specify full path to local files in the HTML. Would it not be logical that it then loads it regardless?
Under Windows it works fine. SU makes a temp file which it writes the html to and loads it. Everything dandy.
Under OSX:
If you use local paths such as'/Users/thomas/desktop/hello.html'
- that works when you use.set_file
But, when you use.set_html
, you have to prefix withfile:///
- like so:'file:///Users/thomas/desktop/hello.html'
I don't understand why there is a difference. I would have understood if also
.set_file
requires thefile:///
prefix - that it requires you to explicitly indicate local file instead if http. But.set_file
is more forgiving for some reason. Maybe it's an OSX path thing that I won't understand... -
can you put the exact and complete thing that you use ? why do you send a file to set_html ?
file:/// = file:// + / (root directory)
ps. funny how I joined SCF exactly 1day and 10hours later
-
@unknownuser said:
can you put the exact and complete thing that you use ?
I'll post an example later today.
@unknownuser said:
why do you send a file to set_html ?
Because I use an template HTML file which I pre-process before sending to the webdialog.
@unknownuser said:
file:/// = file:// + / (root directory)
Yup, ensuring that format worked under OSX and Windows. It's probably the correct way to specify local paths. (I only worked with http paths when I did web dev.)
@unknownuser said:
ps. funny how I joined SCF exactly 1day and 10hours later
I began my job October 2007, got introduced to SketchUp, then someone pointed out plugins to me - and I was hooked. SketchUcation seemed like the place to be for one's SketchUp needs. -
You can put your javascript in a try / catch block.
Also, since you are on a Mac, you can enable the development tools for Safari through Preferences -> Advanced, and then go to Develop -> Start Debugging Javascript to get a console up.
It doesn't work with WebDialog dialogs, but if your html is structured to load outside of SketchUp (or you can comment out SU specific stuff) then you can test the majority of your logic in a native browser before adding the SU stuff back in piecemeal.
-
@unknownuser said:
Also, since you are on a Mac, you can enable the development tools for Safari through Preferences -> Advanced, and then go to Develop -> Start Debugging Javascript to get a console up.
I was looking for that - in that section. ...maybe I wasn't looking hard enough. I tend to go blind when I have thing straight in front of me.
@unknownuser said:
It doesn't work with WebDialog dialogs,
Think I used Firebug Lite before... least under Windows.
-
@thomthom said:
Think I used Firebug Lite before... least under Windows.
I've used fire bug on the mac,
but you could try line feeding console as well. I've been working on some 'little helpers' using apple script to send anything I copy to console, I'll attach a basic script.
TextWrangler and TextMate are both scriptable so you could have a direct link from them. I haven't done that bit yet.john... change it back to a scpt doc first
it's fairly well commented -
@unknownuser said:
ps. funny how I joined SCF exactly 1day and 10hours later
Looks like exactly 22 hours to me.
-
This problem has now re-ocurred, as of Safari 5.0.6 even using
file:///
doesn't work. Onlyhttp
resources appear to load.Seems to be a problem with how the HTML is loaded into the WebDialog under OSX.
Since under Windows you get a temp file, and
document.location
reflects that. But under OSX you just getabout:blank
which might indicate that under OSX SketchUp doesn't use a temp file - and therefore the web control isn't given access to the local files because it (Safari) thinks it might be code from the evil intraweb which tries to access the computer... just a theory... -
@unknownuser said:
It doesn't work with WebDialog dialogs, but if your html is structured to load outside of SketchUp (or you can comment out SU specific stuff) then you can test the majority of your logic in a native browser before adding the SU stuff back in piecemeal.
it does work with WebDialogs, but you need to add it manually to the .plist
%(#008000)[To enable the Web Inspector panel in WebDialog on Mac OSX...
-
Go to ~/Library/Preferences/com.google.sketchupfree[n].plist
-
Open the file with the Property List Editor.app(default) or other
-
Click on any line and then the add [+] icon
-
new item name "WebKitDeveloperExtras", then tab
-
set type to boolean, then tab
-
check box, sets this value to true
-
open Sketchup, open a WebDialog, right click and select in a void "Inspect element" to open Inspector
and it even splits off into separate window.... finally]
john
-
-
Thanks. I'll try that soon when I get the chance.
Advertisement