sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Onload issue with web-dialog window on Mac.

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 3 Posters 439 Views 3 Watching
    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.
    • renderizaR Offline
      renderiza
      last edited by

      Hi,

      I received this suggestion to fix my "Rename by Layer" plugin but I am not sure how to solve it. Can someone help me figure this out? I have no mac so its hard to work bugs for them. πŸ˜•

      @unknownuser said:

      In RND_Renamer/rnd_renamer.html:

      Comment on line 8:
      <body onLoad="startup(), stopwatch(this.value);">
      Using BODY onLoad will cause a blank WebDialog windows under OSX when it opens. The content appear after right clicking or resizing. To work around this, move the functions calls from this event to a SCRIPT element at the bottom of the page, or use the DOMContentLoaded event. (Though this need more work for cross browser compatibility unless you use a framework like jQuery.)

      Not sure how to solve it.

      [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

      1 Reply Last reply Reply Quote 0
      • S Offline
        slbaumgartner
        last edited by

        @renderiza said:

        Hi,

        I received this suggestion to fix my "Rename by Layer" plugin but I am not sure how to solve it. Can someone help me figure this out? I have no mac so its hard to work bugs for them. πŸ˜•

        @unknownuser said:

        In RND_Renamer/rnd_renamer.html:

        Comment on line 8:
        <body onLoad="startup(), stopwatch(this.value);">
        Using BODY onLoad will cause a blank WebDialog windows under OSX when it opens. The content appear after right clicking or resizing. To work around this, move the functions calls from this event to a SCRIPT element at the bottom of the page, or use the DOMContentLoaded event. (Though this need more work for cross browser compatibility unless you use a framework like jQuery.)

        Not sure how to solve it.

        Move the script from the onLoad event to the last element in the body. This is a much discussed and criticized aspect of the WebDialog startup on the Mac.

        1 Reply Last reply Reply Quote 0
        • renderizaR Offline
          renderiza
          last edited by

          @slbaumgartner said:

          Move the script from the onLoad event to the last element in the body. This is a much discussed and criticized aspect of the WebDialog startup on the Mac.

          I am sorry but I don't know what you mean by last element in body. 😳

          Can you provide an example:

          <html>
            <head>
            </head>
            <body onLoad="startup();">
            </body>
          </html>
          
          <script>
            function startup() {
              nextFrame();
            }
          </script>
          

          Thanks in advance

          [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

          1 Reply Last reply Reply Quote 0
          • S Offline
            slbaumgartner
            last edited by

            @renderiza said:

            @slbaumgartner said:

            Move the script from the onLoad event to the last element in the body. This is a much discussed and criticized aspect of the WebDialog startup on the Mac.

            I am sorry but I don't know what you mean by last element in body. 😳

            Can you provide an example:

            <html>
            >   <head>
            >   </head>
            >   <body onLoad="startup();">
            >   </body>
            > </html>
            > 
            > <script>
            >   function startup() {
            >     nextFrame();
            >   }
            > </script>
            

            Thanks in advance

            Remove the onLoad from <body> and then move the <script> … </script> up as the last element before </body>. You will also need either to invoke the startup() function you have defined after the } or else just call nextFrame(); without the function (if you don't also need it elsewhere). The script will be run as the last step of loading the body on both Windows and Mac.

            1 Reply Last reply Reply Quote 0
            • renderizaR Offline
              renderiza
              last edited by

              @slbaumgartner said:

              Remove the onLoad from <body> and then move the <script> … </script> up as the last element before </body>. You will also need either to invoke the startup() function you have defined after the } or else just call nextFrame(); without the function (if you don't also need it elsewhere). The script will be run as the last step of loading the body on both Windows and Mac.

              Thank you so much I think I got it with your help! πŸ‘

              Can't test it since I don't have a Mac but will upload an update in hopes that someone can verify if it works. Again thank you very much!

              [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

              1 Reply Last reply Reply Quote 0
              • tt_suT Offline
                tt_su
                last edited by

                If your code looked like this:

                <html>
                  <head>
                  </head>
                  <body onLoad="nextFrame()">
                
                  </body>
                </html>
                

                Change it to this:

                <html>
                  <head>
                  </head>
                  <body>
                
                  <script>
                    nextFrame();
                  </script>
                  </body>
                </html>
                

                That will prevent the initial white dialog under OSX.

                On a sidenote, I always recommend jQuery or similar frameworks. They take care of most cross compatibility issues - even in this case because jQuery.ready() event uses the DOM ready event which doesn't cause any white out.

                1 Reply Last reply Reply Quote 0
                • renderizaR Offline
                  renderiza
                  last edited by

                  @tt_su said:

                  That will prevent the initial white dialog under OSX.

                  Yes I did that and received feedback from a Mac user that the dialog was loading ok.

                  @tt_su said:

                  On a sidenote, I always recommend jQuery or similar frameworks. They take care of most cross compatibility issues - even in this case because jQuery.ready() event uses the DOM ready event which doesn't cause any white out.

                  I will need to study how to implement this for future...thanks!

                  [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                  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