WebDialog.set_html fails under Safari 5.0.6
-
@unknownuser said:
@thomthom said:
I'm thinking I might not need temp files at all. I just need to send the HTML to the webdialog via
.execute_script
to a proxy HTML document that replaces the content.I remember that execute_script suffered from a string size limitation on Mac?
Maybe this is fine now.Fredo
Arrgh - yea I've heard rumors about that. Cursed how troublesome the WebDialog should be under OSX!
@driven said:
if that's what you mean, and it lived beside window.html can't all your links then be relative i.e. href=css/ui.css, src=js/base.js, etc...
Yes. In fact, I made them relative in 2.5.5 because they relied on the BASE tag in the header which pointed everything to the root dir of the webdialog.
-
@unknownuser said:
I remember that execute_script suffered from a string size limitation on Mac?
Well there's always injecting a external script file.
dlg.execute_script %[ var xx = document.createElement('script'); xx.type = 'text/javascript'; xx.src = "file;//some/path/to/script.js"; document.getElementsByTagName('head')[0].appendChild(xx) ]
-
@dan rathbun said:
@unknownuser said:
I remember that execute_script suffered from a string size limitation on Mac?
Well there's always injecting a external script file.
dlg.execute_script %[ > var xx = document.createElement('script'); > xx.type = 'text/javascript'; > xx.src = "file;//some/path/to/script.js"; > document.getElementsByTagName('head')[0].appendChild(xx) > ]
But we wanted to send the HTML itself to the webdialog for replacement as a way to avoid temp files.
-
Right ok.. same kind of deal.
assume you have a block of html text in Ruby
htmltext
-
You open the dialog with a blank body template using
set_file()
-
Then create a Js var called bodytext (as above)
-
Successively...
... take chucks ofhtmltext
and assign tohtmlpart
... and useexecute_script("body_text += '#{htmlpart}'")
.. or similar until all the Ruby-side text has been transfered. -
then call
execute_script("document.body.innerHtml=body_text;")
-
-
Yea, I was planning on adding a large data pump to my library anyway. But I need to work out what the data limit is... Hopefully I can just send a very large string from ruby and compare it in JS.
-
Actually, what I really hope for is that
at_exit
works under OSX. -
@thomthom said:
Cursed - this is more troublesome than I thought.
Under Windows I can clean up all temps by usingAppObserver.onQuit
- but under OSX it appear to never trigger.So then there's no way under OSX that my proposed workaround for the Instance Observer can work for SU8.
Makes me wonder if "they" just turned off the
onQuit()
callback (for OSX,) as a 'quick-temporary-fix' for the BugSplat! on close issue? -
@dan rathbun said:
Makes me wonder if "they" just turned off the
onQuit()
callback (for OSX,) as a 'quick-temporary-fix' for the BugSplat! on close issue?hm... when was that fix issued? I'd like to try with an older SU to check.
-
@thomthom said:
@dan rathbun said:
Makes me wonder if "they" just turned off the
onQuit()
callback (for OSX,) as a 'quick-temporary-fix' for the BugSplat! on close issue?hm... when was that fix issued? I'd like to try with an older SU to check.
I am speculating... remember during v8 beta the Instance Observer OSX BugSplat! on close without saving the model first?
It was not fixed for 8.0M1.However you have that
onQuit()
works for v7.1 on OSX. -
I tried
onQuit
andat_exit
on OSX SU 7.1.6859 and I could not get them to trigger either... -
It's a bit confusing to have your Observer table combined with both platforms, have you thot about having a table for each platform?
-
And just to be clear, your testing using the Ruby ver that ships with the Sketchup version? (v1.8.5-p0)
What happens if your change the Sketchup Ruby symbolic links on the Mac to a newer Ruby install (v1.8.6-p287 or higher?)
-
And also you might try to trap the
SystemExit
exeception, which is supposed to be called, unless Google usedexit!()
in which case your out of luck.I'm not sure if
Kernel.set_trace_func
will catch a call toexit!()
or not. -
@dan rathbun said:
It's a bit confusing to have your Observer table combined with both platforms, have you thot about having a table for each platform?
Wouldn't having two tables make it harder to get an overview of what observers has issues?
@dan rathbun said:
And just to be clear, your testing using the Ruby ver that ships with the Sketchup version? (v1.8.5-p0)
What happens if your change the Sketchup Ruby symbolic links on the Mac to a newer Ruby install (v1.8.6-p287 or higher?)
Yes - I only test SketchUp out of the box. And that is complicated and time-consuming enough...
-
I wish someone could make a one-click dmg installer for Sketchup Mac that would bring their Ruby up to par with the PC edition.
-
The problem seems to be in all versions after 5.0.6
A user encountered the problem on Safari Version 5.1 (7534.48.3): images not shozing and Update (via xmlhttprequest not working)
Fred
-
I'm a bit confused here.
So if you would use set_file then all should work fine?
I'm using that method and it loads a html file but the linked js files inside do not seem to work.
They do however work when just opening the html file with Safari. (So not in a webdialog) -
@pout said:
I'm a bit confused here.
So if you would use set_file then all should work fine?
I'm using that method and it loads a html file but the linked js files inside do not seem to work.
They do however work when just opening the html file with Safari. (So not in a webdialog)Yes,
set_file
should work. Got a sample of what is not working? -
-
and in SU you can launch by TESTOLA.testing in ruby console
Advertisement