• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Enable error reporting for WebDialogs under OSX?

Scheduled Pinned Locked Moved Developers' Forum
15 Posts 5 Posters 2.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    thomthom
    last edited by 2 Feb 2011, 20:24

    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?

    Thomas Thomassen β€” SketchUp Monkey & Coding addict
    List of my plugins and link to the CookieWare fund

    1 Reply Last reply Reply Quote 0
    • J Offline
      jeff hammond
      last edited by 2 Feb 2011, 20:33

      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 πŸ˜„ )

      dotdotdot

      1 Reply Last reply Reply Quote 0
      • T Offline
        thomthom
        last edited by 2 Feb 2011, 21:07

        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!

        ❓ ❗ ❓ ❓ ❓

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 2 Feb 2011, 21:30

          Under Windows when I use .set_html, document.location returns the path to a temp file SU created with the HTML string.
          Under OSX document.location returns about:blank.

          document location.png

          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.

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • T Offline
            tbd
            last edited by 2 Feb 2011, 21:42

            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

            SketchUp Ruby Consultant | Podium 1.x developer
            http://plugins.ro

            1 Reply Last reply Reply Quote 0
            • T Offline
              thomthom
              last edited by 2 Feb 2011, 22:06

              @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 with file:/// - 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 the file:/// 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...

              Thomas Thomassen β€” SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • T Offline
                tbd
                last edited by 2 Feb 2011, 23:03

                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 πŸ˜‰

                SketchUp Ruby Consultant | Podium 1.x developer
                http://plugins.ro

                1 Reply Last reply Reply Quote 0
                • T Offline
                  thomthom
                  last edited by 3 Feb 2011, 07:23

                  @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.

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    todd burch
                    last edited by 3 Feb 2011, 12:39

                    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.

                    Advanced.jpg

                    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.

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      thomthom
                      last edited by 3 Feb 2011, 12:59

                      @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.

                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                      List of my plugins and link to the CookieWare fund

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        driven
                        last edited by 3 Feb 2011, 13:20

                        @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

                        learn from the mistakes of others, you may not live long enough to make them all yourself...

                        1 Reply Last reply Reply Quote 0
                        • T Offline
                          todd burch
                          last edited by 3 Feb 2011, 13:23

                          @unknownuser said:

                          ps. funny how I joined SCF exactly 1day and 10hours later πŸ˜‰

                          Looks like exactly 22 hours to me.

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            thomthom
                            last edited by 1 Sept 2011, 18:58

                            This problem has now re-ocurred, as of Safari 5.0.6 even using file:/// doesn't work. Only http 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 get about: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...

                            Thomas Thomassen β€” SketchUp Monkey & Coding addict
                            List of my plugins and link to the CookieWare fund

                            1 Reply Last reply Reply Quote 0
                            • D Offline
                              driven
                              last edited by 1 Sept 2011, 19:13

                              @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...

                              1. Go to ~/Library/Preferences/com.google.sketchupfree[n].plist

                              2. Open the file with the Property List Editor.app(default) or other

                              3. Click on any line and then the add [+] icon

                              4. new item name "WebKitDeveloperExtras", then tab

                              5. set type to boolean, then tab

                              6. check box, sets this value to true

                              7. 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

                              learn from the mistakes of others, you may not live long enough to make them all yourself...

                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                thomthom
                                last edited by 1 Sept 2011, 21:04

                                Thanks. I'll try that soon when I get the chance.

                                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 Reply Last reply Reply Quote 0
                                • 1 / 1
                                • First post
                                  Last post
                                Buy SketchPlus
                                Buy SUbD
                                Buy WrapR
                                Buy eBook
                                Buy Modelur
                                Buy Vertex Tools
                                Buy SketchCuisine
                                Buy FormFonts

                                Advertisement