Categories
Javascript

Deal with JavaScript and Cookies

JavaScript cookie is the most efficient method of tracking and remembering preferences, lets you store user information in small text files on computer. By definition, a cookie is a nothing but a piece of data that is sent from a website and stored locally by the user’s browser. Basically, web browsers and servers use HTTP […]

Categories
Javascript

Print a web page content using JavaScript

Are you aware of printing the content of a web page via an actual printer using JavaScript? Don’t get confuse! JavaScript can help you to implement print functionality using a print function of window object. This works on all modern browsers, so this can be a valid substitute inside a browser where toolbar is disabled. […]

Categories
Javascript

Placement of JavaScript in HTML

For including JavaScript code in a HTML document, there is always a flexibility to put in head or body section. A JavaScript function is nothing but a block of JavaScript code which can be executed when required. In HTML, we need to insert JavaScript code between the <script>…</script> tags. Most of the time we include […]

Categories
Javascript

Prevent tinymce from stripping empty tags from input

Using a empty tag in tinymce removes the tag until they have a content in between and switching in HTML mode, all your tags are gone? When you try to insert the following using the HTML button (or code plugin) and verify it afterwards using the HTML button (trying to submit the editor content) – […]

Categories
Javascript

HTML noscript Tag

For a browser which doesn’t support script or disabled scripts in their browser, the ‘noscript’ tag defines an alternate content for the users. If scripts are not supported or disabled in the user’s browser, then, the content inside the ‘noscript’ tag will be displayed. This can be placed in both <head> and <body>. For inside […]

Categories
Javascript

Advantages and disadvantages of JavaScript

JavaScript client side scripting provides many advantages over server side scripts. For example, using JavaScript, you can check if any user has entered a correct email address in a form field. JavaScript is one of the most simple, lightweight, versatile and interpreted programming language used to extend functionality in websites. It also possesses some negative […]

Categories
Javascript

async vs defer attributes in javaScript

In JavaScript scripting language, the async and defer attributes have a great support. So, let’s see how these attributes works. So, first of all we need to know how script works without any attributes. At first, the HTML file is parsed until the script file comes. Then, parsing stops and fetches the file and script […]

Categories
Javascript

JavaScript performance boosting tips

Client side java Script can make your application more dynamic and active. Let’s see some performance tips that will make your JavaScript fly. Basically, the browser’s interpretation of a code can itself introduce inefficiencies. So, the performance of different constructs may varies from client to client. Below tips can make a best practices to optimize […]

Categories
Javascript

Difference between call and apply in JavaScript

One of the very common thing which confuse you while writing JavaScript is knowing when to use “call” and when to use “apply”. Let’s look at following example: var person1 = {name: ‘John’, age: 52, size: ‘2X’}; var person2 = {name: ‘Jane’, age: 26, size: ‘5X’}; var sayHello = function(){ alert(‘Hello, ‘ + this.name); }; […]

Categories
Javascript jQuery

Difference between window.location.href and location.reload

window location href and location reload() both redirects a page to a new page but there are some difference to follow. Here is the difference between window.location.href and location.reload: window.location.href is not a method. It is a property which will tell you the current URL location of the browser. Changing the value of the property […]