How to detect if html was opened as a webdialog
-
I have a javascript/html application (.hta) that runs as an independent application. Is there a way to have it detect if were opened as a webdialog via SketchUp?
I tried to test the skp: protocol, but that opened a new window.
if (window.location="skp:")
// webdialog
else
// sketchup not available -
Darn, Thom must have left work and be out drinking beer and eating cookies already.
Anyhow, for future reference I ended up checking the window.location.href - which is a file path in both sketchup and the .hta. The webdialog uses a .htm file and the hta uses the same file renamed to .hta. If the filename extension is .htm, sketchup is available.
-
I was drinking beer and playing poker. ...and lost...
@jim said:
I tried to test the skp: protocol, but that opened a new window.
if (window.location="skp:")
You're assigning
window.location
to"skp:"
- you used a single =
Like ruby, you must use == to test for equality.@jim said:
Anyhow, for future reference I ended up checking the window.location.href - which is a file path in both sketchup and the .hta. The webdialog uses a .htm file and the hta uses the same file renamed to .hta. If the filename extension is .htm, sketchup is available.
I don't quite get that. You have a .hta application, you also use that in a Webdialog. You use
WebDialog.set_file("myHTA.hta")
andwindow.location.href = "myHTA.htm"
?? -
Thanks Thomas,
I've thought some more and decided I am taking the wrong path. Better to separate out the common features from the sketchup/non-sketchup features; and only include what we need.
-
Now I'm curious to what you're cooking.
-
I've been helping Chris Glasier.
-
@thomthom said:
You have a .hta application, you also use that in a Webdialog. You use
WebDialog.set_file("myHTA.hta")
andwindow.location.href = "myHTA.htm"
??Firstly as htas are not compatible with Macs we thought we ought to try and get a WD version working for them.
Secondly we know we can launch Sketchup from an hta but we haven't got as far as seeing how to manipulate within it preferably from a single plan/do interface.
Anyway thanks again for your help. I thought you deserved some kind of explanation.
Regards
Chris
Advertisement