Does anybody knows if there is any kind of html (javascript, vbscript, etc) to detect if celestia is available on the computer?
Thanks a lot
Dami??n
Script to Detect if Celestia is available on a computer
-
Topic authordamianpiccolo
- Posts: 3
- Joined: 08.06.2005
- With us: 19 years 5 months
This is an interesting problem.
Actually the official definition of Javascript 1.1 knows an object 'mimeTypes' which is located beneath the 'navigator' object, and adressed as 'navigator.mimeTypes[...]'. So the following html-code should show all known mime types, including the Celestia 'cel' and 'celx' type:
And the following html-code should report if Celestia is available on that computer:
Unfortunately every browser is playing his own game here:
- IE knows the 'mimeType' object only for compatibility reasons, but always leaves it empty.
- Gecko engine browsers (Netscape 6 and 7, Mozilla and Firefox) only list those mime types for which there exists real browser plugins (which is not the case for cel and celx, but also - for example - jpeg).
- Opera and Netscape 4 are actually the only browsers which interprets the above examples according to the standard.
Though I like using the Firefox browser, it's Javascript compatibility seems quite lousy (instead there is an increasing plugin hype).
maxim
Actually the official definition of Javascript 1.1 knows an object 'mimeTypes' which is located beneath the 'navigator' object, and adressed as 'navigator.mimeTypes[...]'. So the following html-code should show all known mime types, including the Celestia 'cel' and 'celx' type:
Code: Select all
<html>
<head>
<title>Mime Type Test</title>
</head>
<body>
<b>The following Mime Types are known:</b>
<script type="text/javascript">
<!--
for(var i=0; i<navigator.mimeTypes.length; ++i)
document.write("<br>" + navigator.mimeTypes[i].type);
//-->
</script>
</body>
</html>
And the following html-code should report if Celestia is available on that computer:
Code: Select all
<html>
<head>
<title>Celestia Existence Test</title>
<script type="text/javascript">
<!--
if (navigator.mimeTypes["application/celestia"])
alert("Celestia is available on this computer!");
else
alert("Celestia is not available!");
//-->
</script>
</head>
<body>
Celestia Existence Test
</body>
</html>
Unfortunately every browser is playing his own game here:
- IE knows the 'mimeType' object only for compatibility reasons, but always leaves it empty.
- Gecko engine browsers (Netscape 6 and 7, Mozilla and Firefox) only list those mime types for which there exists real browser plugins (which is not the case for cel and celx, but also - for example - jpeg).
- Opera and Netscape 4 are actually the only browsers which interprets the above examples according to the standard.
Though I like using the Firefox browser, it's Javascript compatibility seems quite lousy (instead there is an increasing plugin hype).
maxim
-
Topic authordamianpiccolo
- Posts: 3
- Joined: 08.06.2005
- With us: 19 years 5 months
- t00fri
- Developer
- Posts: 8772
- Joined: 29.03.2002
- Age: 22
- With us: 22 years 7 months
- Location: Hamburg, Germany
In Linux I just type
> which celestia
on my machine the result is
>/usr/local/bin/celestia
or one may type
> locate celestia
then a very long output follows
Html or similar seems like a bad idea since usually only a very limited amount of directories is made accessible to HTML-browsing for reasons of security.
Irrespective of HTML, the task is so trivial that someone must have been joking around here...
Bye Fridger
> which celestia
on my machine the result is
>/usr/local/bin/celestia
or one may type
> locate celestia
then a very long output follows
Html or similar seems like a bad idea since usually only a very limited amount of directories is made accessible to HTML-browsing for reasons of security.
Irrespective of HTML, the task is so trivial that someone must have been joking around here...
Bye Fridger
I suppose that the intentation may be, to enable automatic detection via browser on a web page where some cel/URLs or links to cel-scripts are displayed. So that the user doesn't get the default 'broken link' error page, but a report of what is missing for a proper display of the links contents (or even a note where to get a Celestia installation).
Of course you can simply look on your 'installed applications' list if you want to know it for yourself. The popup messages in the example above are for demonstration only.
maxim
Of course you can simply look on your 'installed applications' list if you want to know it for yourself. The popup messages in the example above are for demonstration only.
maxim
-
Topic authordamianpiccolo
- Posts: 3
- Joined: 08.06.2005
- With us: 19 years 5 months
Basically I need this script to do what Maxim has said: to enable automatic detection via browser on a web page where some cel/URLs or links to cel-scripts are displayed.
I'm designing a flash file for an educational program and I'm trying to show information about planets and moons, and in case the computer has celestia I want to launch celestia with some scripts...
By the way, thanks to everybody for your answers... I tried the scripts that Maxim sent, and as he said the show no results in IE and Firefox.
I'm designing a flash file for an educational program and I'm trying to show information about planets and moons, and in case the computer has celestia I want to launch celestia with some scripts...
By the way, thanks to everybody for your answers... I tried the scripts that Maxim sent, and as he said the show no results in IE and Firefox.