loading

Finally, Javascript & DOM more powerfull than what I thought ...

.
Hi ...

I needed to quickly code a tiny tool-application, but I did not want to spend days and nights learning the API of a new GUI (under linux), neither I wanted to fight with usual C/C++ bugs, memory leaks and crashes, neither I wanted to learn a new scripting language like Python or Perl ...

I wanted to do simple and fast, and if possible using my current knowledges : my webbrowser would do the GUI, and PHP would be my programming language.

At first sight, I did not consider Javascript as a serious (or main) option, because I've kept very bad memories from Internet Explorer that I mistakenly considered as "the reference" ...
But Mozila based browsers are more compatible with W3C than IE !

So, finally, to my great surprise, I've made my app-tool 100% client side .......................... I don't even need PHP.

However, when I run it on IE, it does not work as expected .....

And my question is : for the sake of compatibility, what's the best strategy ?
1) "downgrading" the scripts to make them compatible with every targeted web-browsers ?
2) writing several version of the scripts, one for each web-browser ?

Dilemma ... Dilemma ...

Picture of Finally, Javascript & DOM more powerfull than what I thought ...
sort by: active | newest | oldest
gmoon9 years ago
If you can deal with the "stateless" nature of html, I prefer your original strategy--do as much as possible server-side, and use the browser for the GUI. Or maybe some minimal JavaScript to make the GUI at least a little dynamic. Otherwise you'll likely run into incompatibility problems....although when you're finished, you'll know what to avoid, Jscript-wise ;-) Java itself is an option, too, of course.
chooseausername (author)  gmoon9 years ago
I prefer your original strategy--do as much as possible server-side, and use the browser for the GUI.

As I've just reached the limits of the Mozilla's Javascript implementation (can't save Javascript generated documents directly on client-side), finally, I'll be forced to use a server ...
That will indirectly solve a lot of incompatibility problems.

Also, this will give me a chance to try AJAX which I've just discovered .........

About Java, I tried it once, and I did not like it ... so, as long as I can avoid it, I think I will ...

Do you code in Java ?

=o)
I've never been a huge fan of JScript; partly due to security concerns early on, and partly due it's generally weak implementation--I could never do what I wanted. But I do think with AJAX it's come into it's own...

I did quite a bit with Java early in it's evolution (V1.1), and liked it--but from an application perspective there were a lot of incompatibilities between windoz and Linux (contrary to it's alleged non-platform specific nature.) Problems that aren't as prevalent now. Although there are still footprint issues (runtime JIT, etc.)

My learning path (C -> Java -> C++) was a big mistake--Java is more abstract and truly object oriented than C++, which felt like a huge step backwards. Even discounting memory management...

Java is still more cohesive for OO. Everything is an object. Less confusion re: definition vs. instantiation, binding, etc. No need to spread out definitions in multiple files. More true encapsulation. All the OO stuff like polymorphism, inheritance, etc. really work easily.

And for ADTs in Java, the base storage class is an object. So you can store different types of objects in the same list or vector, which is really nice. The STL is cool, but you can't beat the convenience of the Java way... Java object serialization is cool, too.

And the GUIs work more like X Windows than M$, so that's cool, too.

I've never use C#, but I assume it handles OO in a way similar to Java...
zachninme gmoon9 years ago
There is a way to save, but its really frowned upon, even more so than eval()!
TiddlyWiki uses it, though.

So yeah, AJAX would be a much better idea.

Also, I kind of enjoy Javascript, and ECMAscript in general. Its fairly strong, considering its largely bound to the browser, but I've can't recall hitting something that it can't do. (within reason, of course)

It also has a really interesting variable scheme, and the way objects work is interesting.

Another thing that I *love* w/ it is how close it is tied into XML, litterally seemlessly integrating itself.
chooseausername (author)  zachninme9 years ago
There is a way to save, but its really frowned upon, even more so than eval()!
TiddlyWiki uses it, though.

Actually, seems I can save a page where a part of the content has been modified by Javascript. And when I load it, I can resume the work where it stopped.
However, I can't manage to save the content of a window opened by Javascript.

For instance :
var w = window.open('about:blank','my_new_window');    w.document.open();    w.document.write("Hello World !");    w.document.close();

If I save the content of this new window, that's the code of the parent window that will be saved instead ...

I tried TiddlyWiki to see how they manage to save their files, and they seem to rely on plugins ...
gmoon zachninme9 years ago
Time I looked at AJAX more closely, me thinks....
chooseausername (author)  gmoon9 years ago
My learning path (C -> Java -> C++) was a big mistake--Java is more abstract and truly object oriented than C++, which felt like a huge step backwards. Even discounting memory management...

Java sounds really seducing when you talk about it.

Unfortunately, my weird self-learning path (Basic Locomotive -> Asm Z80 -> QBasic -> Pascal -> C -> Euphoria -> C/C++ (it's not really fully C++)) did not help me to adopt Java despite I'd love to write applets ... However, I'm more seduced by the so unknown and unused D language.
It's probably because, when I tried Java for the first, I did not understand the OO concepts correctly.
Maybe I'd like it if I tried it again ......
NachoMahma9 years ago
. I'd try to keep it all in one program - updating multiple versions can be a PITA. For the parts that aren't working, maybe test to see which browser is being used and then branch to the appropriate routine.
chooseausername (author)  NachoMahma9 years ago
Thanks, I think you're right.

Anyway, as I've just reached the limits of my JS implementation, I'm going to be forced to use a server, and this will indirectly allow to solve many incompatibility problems.

=o)
I agree, checking the browser being used in javascript is a snap too.