Onload issue with web-dialog window on Mac.
-
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.
-
@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.
-
@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
-
@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.
-
@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!
-
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.
-
@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!
Advertisement