background preloader

Cookies

Cookies
Page last changed today See section 6G of the book. This script was originally written by Scott Andrew. Copied and edited by permission. This article has been translated into French On this page I give three functions to save, read and erase cookies. First an introduction to cookies, and a summary of document.cookie, followed by an example. Cookies Cookies were originally invented by Netscape to give 'memory' to web servers and browsers. This can be annoying in a number of ways. Cookies were invented to solve this problem. A cookie is nothing but a small text file that's stored in your browser. A name-value pair containing the actual dataAn expiry date after which it is no longer validThe domain and path of the server it should be sent to As soon as you request a page from a server to which a cookie should be sent, the cookie is added to the HTTP header. So every time you visit the site the cookie comes from, information about you is available. Cookies can be read by JavaScript too. Example

HttpOnly Overview The goal of this section is to introduce, discuss, and provide language specific mitigation techniques for HttpOnly. Who developed HttpOnly? When? According to a daily blog article by Jordan Wiens, “No cookie for you! What is HttpOnly? According to the Microsoft Developer Network, HttpOnly is an additional flag included in a Set-Cookie HTTP response header. The example below shows the syntax used within the HTTP response header: Set-Cookie: <name>=<value>[; <Max-Age>=<age>] [; expires=<date>][; domain=<domain_name>] [; path=<some_path>][; secure][; HttpOnly] If the HttpOnly flag (optional) is included in the HTTP response header, the cookie cannot be accessed through client side script (again if the browser supports this flag). If a browser does not support HttpOnly and a website attempts to set an HttpOnly cookie, the HttpOnly flag will be ignored by the browser, thus creating a traditional, script accessible cookie. Mitigating the Most Common XSS attack using HttpOnly C# Code:

JavaScript Timers with setTimeout and setInterval Home : Articles : JavaScript Timers with setTimeout and setInterval Tutorial by Matt Doyle | Level: Intermediate | Published on 15 January 2007 Categories: In this tutorial we'll look at JavaScript's setTimeout(), clearTimeout(), setInterval() and clearInterval() methods, and show how to use them to set timers and create delayed actions. JavaScript features a handy couple of methods of the window object: setTimeout() and setInterval(). setTimeout() window.setTimeout() allows you to specify that a piece of JavaScript code (called an expression ) will be run a specified number of milliseconds from when the setTimeout() method was called. setTimeout ( , ); where is the JavaScript code to run after milliseconds have elapsed. setTimeout() also returns a numeric timeout ID that can be used to track the timeout. Here's a simple example: Try it yourself! In the above simple example we embedded the entire code for our JavaScript alert box in the setTimeout() call. clearTimeout() clearTimeout ( ); Why?

Login/session cookies, Ajax and security 20+ Brilliant and Advanced jQuery Effects Every new technology has its own comparisons with its competitors as jQuery is closely compared with Flash. Flash was the technology used by many web designers a while ago, but now its the turn of jQuery to add the special effects or interactivity to a website. jQuery makes it easier to create sophisticated custom effects and animations compared to Flash and also jQuery takes a lead when it comes to SEO. Some of the stunning effects which jQuery can produce are sliding in different directions, adding ease to animations, effects like flip-in, sorting, zoom-in effects in photos, panning, creating a Photo shoot effect, slider effects and many more.So we present you some of the links that shows you the demos of various brilliant and advanced effects and it gives you a clear picture in itself without the help of any tutor. 1.Apple like retina effect Achieve a retina like effect as found in Apple iPhones with this plugin with jQuery and CSS. 2.Aviaslider 3.Beautiful Background Image Navigation

Slicing arguments · dropshado.ws In the jQuery Plugins Authoring tutorial, Ralph Holzmann details an intriguing pattern for plugin methods: var args = Array.prototype.slice.call( arguments, 1 );return methods[ method ].apply( this, args );// (edited for clarity) As the tutorial explains, this pattern is what enabled jQuery UI plugins to have multiple methods. Indeed, If you look deep within the coils of jQuery UI widget factory, you’ll find it there as well: var args = slice.call( arguments, 1 );instance[ options ].apply( instance, args );// (again, edited for clarity) I had thought of this argument-slicing method pattern just as another bit of JavaScript witch-craft that seemed to work, but I had no comprehension of why. Today, I’m working on a sort of particle/field class and this pattern finally clicked. // field has multiple particlesfunction Field() { this.particles = []; for ( var i=0; i < max; i++ ) { this.particles.push( new Particle( i ) ); }} Particle.prototype.logIndex = function() { console.log( this.index );}

Online JavaScript beautifier Learn How to Create a jQuery Plugin You might think to yourself, "What is all the fuss with jQuery? You have to download a bunch of plugins to even make the library worth while.". First, that isn't true. Second, the jQuery library was specifically designed for that very purpose. By keeping the core library as small as possible - about 16 kb - users can then apply additional plugins at their own discretion. Our Objective We want to create a plugin that will dynamically adjust the styling of a specified element in order to keep it vertically and horizontally centered on the page at all times - even when the browser window is resized. The Screencast Step 1 The first step when creating a plugin is to add a blank Javascript file. Step 2 Next, paste in the following code. I go into much greater detail in the video, however, I'd still like to go over a few key points. "Center" should be replaced with whatever your plugin's name is. Step 3 You must understand how to manually center an image on a page before creating the plugin. Step 4

How to include a JavaScript file in another JavaScript file

Related: