Crypto.getRandomValues Implementation for IE9 and Firefox - javascript

I am looking for an implementation of crypto.getRandomValues to use it in the Internet Explorer 9 and Firefox. From my basic knowledge of JS/HTML this are not available in those browser.
any idea?

The best example I can find is alert(window.crypto.getRandomValues(new Uint8Array(2))[1]). This will work great for firefox and chrome- but not IE. You'll have to use a third party library such as Clipperz and check to see its compatibility if you want randomness on all three.

Related

How to deal with broken browsers?

I have a general question. I'm working on my first program in JavaScript and while I'm working on them I experienced some weird "broken browser"-problems.
During the weeks of work on my program I tested the project often on different browsers and computer systems. While doing it I observed weird behavior on Firefox and Chrome in specific versions. In both cases the program worked fine in both browsers then suddenly I experienced problems in Firefox on Windows on one machine. After some research I tried to update the browser and the problem was gone. The same experience I had on Chrome on Linux. It worked fine, then suddenly I had problems with Chrome 48. I tested the program on Mac and Windows, everything was fine. Then I recognized that the browsers on this machines has the version 54. So I updated on my Linux machine to the newest version and the problem was gone.
My Question: is it normal that such things happen with specific versions of browsers and if so, how to deal with it if you're working on bigger projects?
Edit: From the answers below I see that I was not clear with my question. The Question is not really about cross-browser compatibility than more about why a programm works in chrome v47, but not in v48, and then it works again in v54. Same for Firefox and other browsers.
You have to read about cross-browser compatibility.
Each browser may have different implemenations of specific functions or even do not have.
For older browsers like IE8 and less even simple window.innerWidth
doesn't work.
jQuery may help you. Its library which effectively provides cross browser compatibility for a lot of cases.
Another way to test if browser support some function is using Modernizr
You can also check support manually by websites like caniuse.com - works mainly for css styles but also js

Firefox 24 has javascript version 1.5

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.

How to make JS and CSS compatible with IE, Firefox, Chrome, Safari?

Our company develops ERP and CRM, and so far our products support IE and Firefox. Now we want to support Chrome, Safari and even Opera. Is there any comprehensive materials that introduce browser compatibility of JS and CSS? thks!
theres the mozilla dev-center that has a great CSS- and JavaScript-reference. Every entry has information about browser compatibility.
For a quick overview, you cauld also take a look at caniuse.com (CSS and JavaScript) that provides simple tabular lists for the different features.
I've been coding the front-end for over a decade and a half now, and things seem to get better over time in regards to cross-browser compatibility. I've found that if I write and test my code using Firefox, most everything will work flawlessly on Chrome, Opera, Safari and the only thing you'll end up having to debug would be MSIE. 10 years ago I would have told you to code and test using MSIE and debug your code in the end with Netscape.
But yeah, if you follow this, you'll find it easier to make all your scripting and markup fully cross-browser compatible with no bugs at all. Enter IE9, of course, a different monster altogether.
Is there any comprehensive materials that introduce browser
compatibility of JS and CSS?
http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(Cascading_Style_Sheets)
http://html5test.com/
http://caniuse.com/
"Comprehensive" can change overnight, but there is a great deal of information available.
If your products work for the latest version of Firefox, Chrome, Safari, and Opera will work without major flaws most of the time. If your markup is invalid, you are using many vendor-specific extensions, or you are using cutting-edge features, this may not be the case.

Start javascript profiling in IE from js-code

I want to start and stop js-profiling from my js-code in Internet Explorer.
Like we can do it in Firefox through:
- console.profile()
- console.profileEnd()
Does anybody know whether it is possible in IE?
For JavaScript, XmlHttpRequest, DOM Access, Rendering Times and Network traffic for IE6, 7 & 8 you can use the free dynaTrace AJAX Edition
I think you are using Firebug with Firefox, so you could use Firebug Lite.
And IE8 has a built-in console, you should read the docs, there are maybe the same functions.

is top.document cross browser?

I'm writing a javascript that relies on top.document but I'm not sure if I can assume all the major browsers supports it or not.
Is top.document cross-browser compatible?
According to W3Schools, window.top is supported in IE (since v4), FF (v1), and Opera (v9). I can personally vouch for it working in Safari as I just tried their example code in my own browser. :-)
I've never used it, but I believe it is.
Nested frames are so passe.
Check out this handy Quirksmode article on the topic.

Categories