The Mozilla Foundation continues to add new language features to JavaScript. They're up to version 1.8 now where 1.5 was more or less the ECMA baseline.
However, Firefox is the only browser that supports the latest version and IE is firmly stuck at a 1.5-equivalent JScript.
What purpose do the Firefox-only extensions serve? Or are they just lying dormant until (and if) the rest of the browsers catch up?
Firefox, Thunderbird, and other XUL apps also have large portions of themselves written in JavaScript. A more featureful JavaScript means a better development environment for Firefox and other Mozilla apps.
Extending the language is a good idea, even if only one browser is doing it - eventually it will prove itself and be made into the standard at which time other browsers will have to catch up.
Otherwise, how can progress be made - Microsoft does this all the time: would XMLHttpRequest have ever made it into the standards if Internet Explorer wouldn't have implemented it first?
From the Mozilla perspective the purpose of these changes, except for adding more capabilities for use by web developers, is to lead up to JavaScript 2.0, that is being developed as the next revision of ECMA 262 (revision 4) TC39 workgroup.
Future browsers will support JavaScript 2.0. In the mean time, developers are invited to take advantage of these extra features - natively in Firefox and using JavaScript libraries that provide backward compatibility with Internet Explorer. I find this very useful.
Also, it may be interesting to note that Webkit (the engine developed by KDE and used by Safari, Chrome and several free software browsers) supports JavaScript 1.7.
The biggest reason at the moment for improved JavaScript is for extension writers, who need not worry about cross-browser compatiblity.
JavaScript is a trademark by Sun which was licensed to Netscape and is now held by the Mozilla Foundation. Microsoft has their own implementation of the language called JScript, but there are others (eg. DMDScript).
ECMAScript was an afterthought to add a common baseline to the various implementations. So it's only natural that language development continues outside the standards committee, which is free to add the changes pioneered by the implementors in future revisions of the standard (eg the array extras introduces in JS1.6 will be in ES3.1).
Related
I am recently reading about Node.js and got an interesting statement about JavaScript and Internet Explorer:
Internet Explorer doesn’t actually support JavaScript or ECMAScript; it supports a language variety called JScript. In recent years, JScript has fully supported the ECMAScript 3 standard and has some ECMAScript 5 support. However, JScript also implements proprietary extensions in the same way that Mozilla JavaScript does and has features that ECMAScript does not.
Source: http://chimera.labs.oreilly.com/books/1234000001808/ch01.html#chap2_id35941400
Frankly speaking I am totally unable to understand the above statement. I know Microsoft has its own VBScript and it allowed JavaScript in IE that is why JS is more popular than any other scripting language. Is this statement true? If yes then the scripting engine of IE does the translations of native JavaScript to JScript or what is the other case?
ECMAScript is the official standard, JavaScript and JScript are implementations of that standard. Just like CPython and Jython are implementations of Python.
As so often if it's about browsers, they both don't necessarily fully support the standard or provide additional, non-standard features, partly because they started evolving when an official standard didn't exist yet.
From Wikipedia about JScript:
[Microsoft] did not want to deal with Sun about the trademark issue, and so they called their implementation JScript. A lot of people think that JScript and JavaScript are different but similar languages. That's not the case. They are just different names for the same language, and the reason the names are different was to get around trademark issues
From the Microsoft documentation about JScript:
JScript is the Microsoft implementation of the ECMA 262 language specification (ECMAScript Edition 3). With only a few minor exceptions (to maintain backwards compatibility), JScript is a full implementation of the ECMA standard.
well, this mainly depends on the version of IE you are using, as you havent mentioned that no one can say that for sure
I think it is not like that instead Microsoft gives you an option to enable Javascript on your IE like this:
Pull down your TOOLS menu
Select Internet Options...
Click the Security tab on the top of the resulting window
Click the Custom Level button
Scroll the list down to the entry for Active Scripting
Check the Enable radio button.
Click OK in all dialogs.
Also Jscript is same as Javascript
JScript is Microsoft's dialect of the ECMAScript standard[2] that is
used in Microsoft's Internet Explorer.
JScript is implemented as a
Active Scripting engine. This means that it can be "plugged in" to OLE
Automation applications that support Active Scripting, such as
Internet Explorer, Active Server Pages, and Windows Script Host.[3] It
also means such applications can use multiple Active Scripting
languages (e.g., JScript, VBScript, PerlScript, etc.).
I can't seem to find any information, but i have Firefox version 24 and when i look at the version of javascript that it uses, i get version 1.5. This is giving me constant headaches because i should have the 1.6 version. I have many bugs and problems with my javascript code related to this problem.
Does anyone know why FF ships with version 1.5 and how can i get the 1.6? I allready lookt up the mozilla forums and developer network, but no help there.
All my other browsers, safari, chrome and opera have newer javascript versions.
See this fiddle:
JavaScript is the original name that Mozilla gave to the language (LiveScript really, but that's history now). All browsers implement ECMAScript, what we know today as JavaScript. JavaScript 1.x is the internal versioning of Mozilla's implementation of ECMAScript. You should be comparing supported features not different implementations of the language since they all implement the same standard, ECMA.
Here's something I've been pondering after countless hours fixing JS to be cross-browser compatible (mostly IE): Why isn't Javascript consistent accross browsers?
I mean, why can't JS be nice like Java and Flash? Instead, we have to resort to frameworks like jQuery. Don't get me wrong, they make my life easier - but why do they even exist in the first place?
Is there a historical reason for this? Do companies rolling out browsers just ship their own JS engine? What are the politics that make standardization so difficult?
(Note: I understand that a good part of the problem is DOM related, but the question remains).
The Javascript core language for the most part is consistent ( Referring to ECMAScript version 3 released in 1999. )
It's the DOM implementations that cause headaches. Partly because at one point there was no DOM specification so browsers could do whatever the hell they wanted in terms of making up the rules for which to access and manipulate html elements in a web page.
For example:
window.addEventListener for DOM supporting browsers, while window.attachEvent for IE.
textContent for DOM supporting browsers, innerText for IE.
Memory leakage for attached event handlers in IE so you have to unload them manually
getElementById is buggy in IE and Opera because it returns elements by name
getAttribute('href') returns inconsistent values
There are also issues relating to the browser's CSS support.
IE6 doesn't support native PNGs so you are forced to use the filter library
Buggy animation in IE dealing with filter opacity
Language core inconsistencies would be things like
Inconsistencies between regex engines
But yeah, in short the point is that before, there was no standard. Since then, the w3 came up with standards, but every browser vendor has its own way of dealing with implementing it. There's no governing body that forces the vendors to fully apply the spec.
Do companies rolling out browsers just ship their own JS engine?
Yup, that's probably the main reason. There is no unified JS engine; there are various implementations of ECMAScript.
Browsers roll their own implementation, plain and simple. It's the same reason why rendering and CSS and all that are different across browsers. Java/Flash/etc. are more universal because they're abstracted out of the browser and accessed via a plugin of some sort. But their actual core implementations are separate from the browser and controlled by a single vendor.
To add to the other answers: there is a historical reason for this. I can write this myself, but quoting Wikipedia is easier on the fingers:
JavaScript was originally developed by
Brendan Eich of Netscape under the
name Mocha, which was later renamed to
LiveScript, and finally to JavaScript.
LiveScript was the official name for
the language when it first shipped in
beta releases of Netscape Navigator
2.0 in September 1995, but it was renamed JavaScript in a joint
announcement with Sun Microsystems on
December 4, 1995 when it was deployed
in the Netscape browser version 2.0B3.
[…]
JavaScript very quickly gained
widespread success as a client-side
scripting language for web pages. As a
consequence, Microsoft developed a
compatible dialect of the language,
naming it JScript to avoid trademark
issues. JScript added new date methods
to fix the non-Y2K-friendly methods in
JavaScript, which were based on
java.util.Date. JScript was included
in Internet Explorer 3.0, released in
August 1996. The dialects are
perceived to be so similar that the
terms "JavaScript" and "JScript" are
often used interchangeably. Microsoft,
however, notes dozens of ways in which
JScript is not ECMA-compliant.
In November, 1996 Netscape announced
that it had submitted JavaScript to
Ecma International for consideration
as an industry standard, and
subsequent work resulted in the
standardized version named ECMAScript.
As you can see, the standard, ECMAScript, was developed later than the original language. It's just a matter of adapting this standard in the current implementations of web browsers, that's still going on, as is the development of ECMAScript itself (e.g., see the specification of ECMAScript 5, published December 2009).
I’m looking for my application (it’s a sort of CRM) to include a web-based GUI that supports old browsers like IE 5.
Is there any good client-side cross-browser framework that supports old browsers? I don’t need something fancy with effects and animations.
Thanks.
For your specific needs check out David Mark's "My Library". It doesn't have the popularity of jQuery or Extjs but for absolute cross-platform portability, nothing beats it. It was developed from best practices gathered from comp.lang.javascript.
He claims:
...after spending a week testing, I am pleased to
announce that Cinsoft supports My Library in the following browsers:
All of them.
But seriously, we've tested successfully in:-
IE 5-8
FF 1-3.5
Safari 2-4
Opera 5-10
Netscape 3-9
I don’t think that’s a problem anyone’s interested in solving (i.e. web-based gui frameworks for older browsers like IE 5).
It’s much harder on older browsers because they lack features, have more bugs, and run JavaScript slower. And there’s less point, because those browsers are disappearing.
If I were you, I’d build a CRM application that’s so good, companies still on IE 5 will install Firefox just to use it.
DynAPI and lib.js are two of the oldest frameworks. They support IE5 and Netscape browsers. There are menu utilities and small abstraction libraries as well.
I have always wondered WHaT tHE HecK?!? is the difference between JScript and JavaScript.
Just different names for what is really ECMAScript. John Resig has a good explanation.
Here's the full version breakdown:
IE 6-7 support JScript 5 (which is equivalent to ECMAScript 3, JavaScript 1.5)
IE 8 supports JScript 6 (which is equivalent to ECMAScript 3, JavaScript 1.5 - more bug fixes over JScript 5)
Firefox 1.0 supports JavaScript 1.5 (ECMAScript 3 equivalent)
Firefox 1.5 supports JavaScript 1.6 (1.5 + Array Extras + E4X + misc.)
Firefox 2.0 supports JavaScript 1.7 (1.6 + Generator + Iterators + let + misc.)
Firefox 3.0 supports JavaScript 1.8 (1.7 + Generator Expressions + Expression Closures + misc.)
The next version of Firefox will support JavaScript 1.9 (1.8 + To be determined)
Opera supports a language that is equivalent to ECMAScript 3 + Getters and Setters + misc.
Safari supports a language that is equivalent to ECMAScript 3 + Getters and Setters + misc.
As far as I can tell, two things:
ActiveXObject constructor
The idiom f(x) = y, which is roughly equivalent to f[x] = y.
From Wikipedia: http://en.wikipedia.org/wiki/Jscript
JScript is the Microsoft dialect of
the ECMAScript scripting language
specification.
JavaScript (the Netscape/Mozilla
implementation of the ECMA
specification), JScript, and
ECMAScript are very similar languages.
In fact the name "JavaScript" is often
used to refer to ECMAScript or
JScript.
Microsoft uses the name JScript for its implementation to avoid trademark issues (JavaScript is a trademark of Oracle Corporation).
JScript is Microsoft's implementation of the ECMAScript specification. JavaScript is the Mozilla implementation of the specification.
Javascript, the language, came first, from Netscape.
Microsoft reverse engineered Javascript and called it JScript to avoid trademark issues with Sun. (Netscape and Sun were partnered up at the time, so this was less of an issue)
The languages are identical, both are dialects of ECMA script, the after-the-fact standard.
Although the languages are identical, since JScript runs in Internet Explorer, it has access to different objects exposed by the browser (such as ActiveXObject)
JScript is the Microsoft implementation of Javascript
According to this article:
JavaScript is a scripting language developed by Netscape Communications designed for developing client and server Internet applications. Netscape Navigator is designed to interpret JavaScript embedded into Web pages. JavaScript is independent of Sun Microsystem's Java language.
Microsoft JScript is an open implementation of Netscape's JavaScript. JScript is a high-performance scripting language designed to create active online content for the World Wide Web. JScript allows developers to link and automate a wide variety of objects in Web pages, including ActiveX controls and Java programs. Microsoft Internet Explorer is designed to interpret JScript embedded into Web pages.
Long time ago, all browser providers were making JavaScript engines for their browsers and only they and god knew what was happening inside this. One beautiful day, ECMA international came and said: let's make engines based on common standard, let's make something general to make life more easy and fun, and they made that standard.
Since all browser providers make their JavaScript engines based on ECMAScript core (standard).
For example, Google Chrome uses V8 engine and this is open source. You can download it and see how C++ program translates a command 'print' of JavaScript to machine code.
Internet Explorer uses JScript (Chakra) engine for their browser and others do so and they all uses common core.
There are some code differences to be aware of.
A negative first parameter to subtr is not supported, e.g. in Javascript: "string".substr(-1) returns "g", whereas in JScript: "string".substr(-1) returns "string"
It's possible to do "string"[0] to get "s" in Javascript, but JScript doesn't support such a construct. (Actually, only modern browsers appear to support the "string"[0] construct.
Wikipedia has this to say about the differences.
In general JScript is an ActiveX scripting language that is probably interpreted as JavaScript by non-IE browsers.
JScript and Javascript is TOTALLY different scripting languages. Javascript runs on the browser, but JScript can use ActiveX objects and has almost total control on your operating system if you've ran it, it can delete files, run or write files, download files from the web(via Powershell) run cmd commands etc. JScript is almost the same thing as VBScript, but has different syntax.
Jscript is a .NET language similar to C#, with the same capabilities and access to all the .NET functions.
JavaScript is run on the ASP Classic server. Use Classic ASP to run the same JavaScript that you have on the Client (excluding HTML5 capabilities). I only have one set of code this way for most of my code.
I run .ASPX JScript when I require Image and Binary File functions, (among many others) that are not in Classic ASP. This code is unique for the server, but extremely powerful.
JScript is Microsoft's equivalent of JavaScript.
Java is an Oracle product and used to be a Sun product.
Oracle bought Sun.
JavaScript + Microsoft = JScript