Write C#. Run JavaScript.

Open Source C# to JavaScript Compiler and Frameworks. Run Your App On Any Device Using JavaScript. Use Bridge.NET to build platform independent applications for mobile, web and desktop. Run on iOS, Windows, Mac, Linux and billions of other devices with JavaScript support. Compile your C# code into native JavaScript and deploy on Billions of devices. Try it on bridge.net or fork it on GitHub

Crypt and decrypt your email with JavaScript

If you want to publish an email on your site but you want to protect it, I have a simple solution   HTML <!DOCTYPE html> <html xmlns="https://www.w3.org/1999/xhtml"> <head> <title></title> <script src="crypto.js"></script> <script src="uncrypto.js"></script> </head> <body> <h1>JavaScript eMail Encrypter</h1> <p>You can encrypt mailto: links on a website, so that spiders can’t detect them, with a simple javascript.</p> <p>Example: <a href="javascript:linkTo_UnCryptMailto(‘nbjmup;spttjojAftjb/dp’);">rossini [at] esia [dot] co</a></p> <form> <div> <div class="container"> <div class="desc">enter your eMail address:</div> <div><input type="text" name="emailField" size="40" maxlength="255" /></div> </div> <div class="container"> <div class="desc"><input type="button" name="ecrypt" value="Crypt eMail Address" onclick="CryptMailto()" /></div>…

Classical Inheritance in JavaScript

JavaScript is a class-free, object-oriented language, and as such, it uses prototypal inheritance instead of classical inheritance. This can be puzzling to programmers trained in conventional object-oriented languages like C++ and Java. JavaScript’s prototypal inheritance has more expressive power than classical inheritance, as we will see presently. Java JavaScript Strongly-typed Loosely-typed Static Dynamic Classical Prototypal Classes Functions Constructors Functions Methods Functions But first, why do we care about inheritance at all? There are primarily two reasons. The first is type convenience. We want the language system to automatically cast references…

What is the JavaScript Equivalent of print_r in PHP?

What is the JavaScript Equivalent of PHP print_r() function? In other words, how you can “print” a javascript object in a way that’s readable by humans? Code You could use JSON.stringify, as following: The HTML part Let’s create two links for demo: <p><a id=”print_demo” href=”javascript:void(0);”>Print object</a></p><p><a id=”pretty_print_demo” href=”javascript:void(0);”>Pretty Print object</a> The JAVASCRIPT part Remark: I use jQuery to handle events, but you can use plain javascript (if you prefer). <script type=”text/javascript”> $(function() { // create an object var person = new Object(); person.firstname = “John”; person.lastname = “Doe”; person.age =…

How to Detect Browser (and browser version) using JavaScript

Browser (and browser version) detection is an “all time classic” development requirement. jQuery.browser WAS an excellent solution, but it was removed in jQuery 1.9. Actually, it would be better to try to detect a browser feature instead of browser name itself, where possible. An ideal solution for this is Modernizr (a JavaScript library that detects HTML5 and CSS3 features in the user’s browser). But, if you still need to detect browser and browser version (using javascript), I suggest the following solutions (among many others): Bowser – A Browser detector and…