SlideShare uma empresa Scribd logo
1 de 9
Baixar para ler offline
Advanced Javascript
         Webworks – A Workshop Series in Web Design (Session 5)

Table of Contents:
   1. Browser and Object detection
   2. Cookies and Stylesheets

Browser and Object Detection
1. Introduction
      There are many browsers out in the great unknown of the internet today. Internet
      Explorer, Netscape, Mozilla Firefox, and Opera are just a few of them, and even
      they have internal version numbers as well. As you can imagine, each has
      slightly different, or even vastly different, ways of interpreting your JavaScript or
      HTML code. Some HTML tags are supported in some but not in others. Not all
      browsers support the same version of JavaScript. Some functions may be
      support on one browser, but not on the next. Displayed text or boxes could even
      look misaligned. How can you limit the number of bugs on your page?

2. Browser Detection vs Object Detection
      Browser detection sniffs out the browser of the entire page, while object detection
      is a more dynamic way of checking the validity of each function as it gets called.
      Browser detection leverages the navigator object that is available to all
      JavaScript code, and while it had its glory days, object detection is now the more
      popular way to sniff out incompatibility. First, we’ll go over browser detection.

3. Browser Detection
      Browser detection was widely popular in the past. JavaScript gets a “navigator”
      object, from which browser data can be collected.

      Useful properties:

Property                      Description
Navigator.appName             Name of the browser (for ex, Microsoft Internet Explorer
Navigator.appVersion          Version of the browser (for ex, 6.0)
Navigator.userAgent           User agent header (for ex, Mozilla/4.0 (compatible; MSIE
                              5.5; Windows 98; Hotbar 3.0))

      For example,
             <script language="JavaScript"
             type="text/JavaScript">
             if(navigator.appName == "Netscape"){
                 window.location = "http://www.netscape.com"
             }
             if(navigator.appName == "Microsoft Internet Explorer"){
                 window.location = "http://www.msn.com"
             }
             window.location == "meh.html"
             </script>
Webworks: Advanced Javascript                                                     Page 2 of 9

       So, we could use this to set up many variables that detect the browser type and
       version, and then use this to either detect which version of our code to use, or to
       phase out parts of our code that might not work under other browsers.

4. Object Detection
       So what’s the problem with using browser detection? Well, as you can see, it’s
       pretty tedious. Many browsers hide their names or have different formats for
       displaying version numbers. You can to check for every browser, and since there
       are so many different kinds, it’s almost impossible to preplan for each. Besides,
       who wants to do that? Here’s where object detection comes in. It actually figures
       out whether the visiting browser supports the object that is going to be used
       before it uses it.

       Let’s look at the classic rollover example. Rollovers use the document.images
       object to get the images on a page. However, this object is only supported by
       Netscape 3+ and IE 4+.

       Here’s how to do it:

       function imgOn(imgName) {
          if (document.images) {
               document[imgName].src = eval(imgName + "ON").src;
          }
       }

       Notice that I called the object, document.images. If it exists, it will return true and
       execute the following code. Notice that if it does not exist, the code will continue
       as if nothing had happened.



Cookies – Quick Overview

What are They?

A very small text file placed on your hard drive by a web page server when you access a
site on that server. It serves as an identification the next time you access web pages on
that server so as to extend the capabilities of web-
based client/server applications. It is uniquely yours
and can only be read by the server that gave it to you.

What are They For?
To let the server know that you have returned to a
page/site you have previously visited. This can be
useful in the following situations:

   •   Suppose you are filling a form and then
       accidentally close the window. A cookie set on
       your machine lets the server remember fields
       already filled-out.
   •   Allows you to customize what you want to see
Webworks: Advanced Javascript                                                  Page 3 of 9

        when you visit a portal like myway.com
   •    Monitors which advertisements were shown to you and how often each was
        shown.

Types of Cookies
There are two types:
   • Session cookies – expire after your session on that site
   • Persistent cookies – remain until you clear your cache and delete cookies

Types of Values a Cookie can Pass
    •   The name of the cookie.
    •   The value of the cookie.
    •   The expiration date of the cookie - how long the cookie is active in your
        browser.
    •   The path of the cookie is valid for - the URL path the cookie us valid in. Web
        pages outside of that path cannot use the cookie.
    •   The domain the cookie is valid for - makes the cookie accessible to pages on
        any of the servers on a multi-server domain.
    •   The need for a secure connection – states if the cookie can only be used on a
        secure server connection, such as on a site using SSL.




Let’s Bake some Cookies

Stage 1 – Cascading Style-Sheets

   Task 1
   • Visit CSS-Zen Garden <http://www.csszengarden.com/>
   • Click on any of the links to the left and observe the content of the pages


As you might have observed, although the index pages all have the same text, their
formatting and layouts differ radically. Each uses a Cascading Style-Sheet (CSS).

Questions:
  • What is a style-sheet?
  • Do you find all the layouts equally appealing?
  • What is the chance that everyone finds your favorite one most appealing?




Stage 2 – Creating the Style-Sheets
Lets now apply the knowledge about cookies to allow each one of us to be able select
how they want their site to be displayed. But first we need to have a style-sheet created
for each new look we want to make available.
Webworks: Advanced Javascript                                                   Page 4 of 9

In real life you would do this when you start designing your site. If you want to learn
more about style-sheets, use Google, visit WC3.org (http://www.w3.org/Style/CSS/) or
come to our Spring CSS tutorial.

For now:

   Task 2
   • Download and unzip cookies.zip to the desktop
   • Open the index file for editing in Macromedia DreamWeaver.


Stage 3 – Attaching the Style-Sheets to the Page
The link element is used to declare the style-sheet. There are three different
relationships external style sheets can have with their parent document: persistent,
preferred, and alternate.

Persistent Sheets
Always on. To make a style sheet persistent, the rel attribute is set to
“stylesheet” and NO title attribute is set.

To make the style sheet “style1.css” persistent, add this code in the head:

<link rel="stylesheet" type="text/css" href="style1.css" />

Preferred Sheets

These style sheets are enabled by default. They can, however, be disabled them if an
alternate style sheet is selected.

To make a style sheet preferred, the rel attribute is set to “stylesheet” and the style
sheet is given a title attribute. For instance, this code makes sheet “style2.css”
preferred.

<link rel="stylesheet" type="text/css" href="style2.css"
title="preferred"/>

Note: It is preferred not because its title is “preferred” but because it has a title.

Style sheets having identical title attributes are form a group. Grouped sheets can be
enabled and disabled in one go. If more than one group of preferred style sheets are
declared, the first group takes precedence.

Alternate Sheets

These style sheets can be selected by the visitor as an alternatives to the author’s
preferred style sheet. This allows the visitor to personalize a site and choose his or her
favorite scheme. They can also be used for accessibility.
Webworks: Advanced Javascript                                                   Page 5 of 9


To specify an alternate style sheet, the rel attribute is set to “alternate
stylesheet” and the style sheet is named with a title attribute. As with preferred
sheets, these style sheets can also be grouped together by giving them identical title
attributes. To make style-sheet “style3.css” an alternate sheet, we place this code in the
head of the document.

<link rel="alternate stylesheet" type="text/css"
href="style2.css" title="alternate" />



     Task 3
     • There are three style-sheets in the cookie folder you created from the zip-
        file you downloaded.
     • Add sheets “style1.css”, “style2.css” and “style3.css” to the
        head of your “index.html“ file
     • Make sheet “style1.css” the persistent sheet.
     • Make sheet “style2.css” the preferred sheet entitled “sassy”
     • Make sheet “style3.css” the alternate sheet entitled “boring”



Swapping Styles


Stage 4 – Programmatically Differentiating Sheets
Ideally, users should be able to select the style-sheet of their choice from the available
list. Sadly, this is not the case so we have to use JavaScript to allow users to make that
choice and remember it for them using a cookie.

The Script

First we need the script to be able to differentiate between the three different types of
style-sheet. This is relatively easy to do, as we only need to check two of the attributes
of each link element.

Is it a link to a style sheet?
 HTMLLinkElement.getAttribute("rel").indexOf("style") != -1

Is there a title attribute?
 HTMLListElement.getAttribute("title")

Does the rel attribute contain the keyword "alternate"?
 HTMLLinkElement.getAttribute("rel").indexOf("alt") != -1
Webworks: Advanced Javascript                                                   Page 6 of 9




Using these three checks we can check every link element in the document, disabling all
preferred and alternate style sheets that we don’t want active, and enabling all preferred
and alternate style sheets that we do want active.

Note: Only preferred and alternate style sheet link elements have a title attribute.

The function to do this looks like this:

 function setActiveStyleSheet(title) {
    var i, a, tagNames;
    tagNames = document.getElementsByTagName("link");
    for(i=0; i < tagNames.length; i++) {
        a = tagNames[i];
      if(a.getAttribute("rel").indexOf("style") != -1
          && a.getAttribute("title")) {
         a.disabled = true;
         if(a.getAttribute("title") == title)
            a.disabled = false;
      }
    }
 }




Stage 5 - Baking Cookies
Now we can change the style sheet. However, the preference only persists on the
current page. To remember the preference, we use cookies.

Cookie processing involves storing the preference to the hard-drive in the form of a
cookie and reading it another time.

The following snippet creates a cookie.


 function createCookie(name,value,days) {
   if (days) {
     var date = new Date();
     date.setTime(date.getTime()+(days*24*60*60*1000));
     var expires = "; expires="+date.toGMTString();
   }
   else expires = "";
   document.cookie = name+"="+value+expires+"; path=/";
 }
Webworks: Advanced Javascript                                                      Page 7 of 9




To read the cookie we use this snippet
 function readCookie(name) {
   var nameEQ = name + "=";
   var ca = document.cookie.split(';');
   for(var i=0;i < ca.length;i++) {
     var c = ca[i];
     while (c.charAt(0)==' ') c = c.substring(1,c.length);
          if (c.indexOf(nameEQ) == 0)
              return c.substring(nameEQ.length,c.length);
   }
   return null;
 }



Stage 6 - Getting the Current Active Style-sheet
To return the current style sheet we locate an active preferred or alternate style sheet
and check its title. To do this we look at all link elements on the page to decide if each is
a style sheets. If it is, we check if has a title. This tells us that the style sheet is either
preferred or alternative.

Finally, we check if the style sheet is active. If all three checks return true, we have the
current style sheet and we can return the title. If not, then we return null.

The function looks like this:

 function getActiveStyleSheet() {
    var i, a, tagNames;
    tagNames = document.getElementsByTagName("link");
    for(i=0; i < tagNames.length; i++) {
       a = tagNames[i];

            if(a.getAttribute("rel").indexOf("style") != -1
                 && a.getAttribute("title")
                 && !a.disabled) return a.getAttribute("title");
           }
           return null;
 }
Webworks: Advanced Javascript                                                     Page 8 of 9


Stage 5 - Using the Cookies
To use these cookie functions, we need to add onload() and onUnload() event listener
handles to the window.

OnLoad()

When document is loaded, we need to tell the browser which style-sheet (our preferred
style-sheet) we want to use as our active style-sheet. The function
setActiveStyleSheet() (see page4) does this.

To find out which style sheet is the preferred style sheet, we need another function -
getActiveStyleSheet() which may look like this:

 function getPreferredStyleSheet() {
     var i, a, tagNames;
     tagNames = document.getElementsByTagName("link");
     for(i=0; i < tagNames.length; i++) {
        a = tagNames[i];
        if(a.getAttribute("rel").indexOf("style") != -1
         && a.getAttribute("rel").indexOf("alt") == -1
         && a.getAttribute("title")
         ) return a.getAttribute("title");
   }
   return null;
 }



In the onload() function, we first set a title variable. This either holds the value of the
previous style sheet that was retrieved from the cookie, or if there isn’t one, the title of
the author’s preferred style sheet. To keep things logical, let’s call the cookie “style.”

Next we call up the setActiveStyleSheet() function passing the title variable as the
title. Our onload function looks something like this:



 window.onload = function(e) {
   var cookie = readCookie("style");
   var title = cookie ? cookie : getPreferredStyleSheet();
   setActiveStyleSheet(title);
 }
Webworks: Advanced Javascript                                                     Page 9 of 9

onUnload()

When we leave the page, we want to remember the style-sheet for another day, so we
save it. We use the onUnload listener message handle to do this. This function gets the
current active style-sheet, and saves it in a cookie:

 window.onunload = function(e) {
   var title = getActiveStyleSheet();
   createCookie("style", title, 365);
 }




Stage 6 - Integrating it all
We store all these functions in a JavaScript file named styleswitcher.js, and load
the file inside the head of the document, making sure the script file is loaded after all the
style-sheet link elements like this:

<script type="text/JavaScript" src="styleswitcher.js"></script>

To allow visitors to change the active style sheet, we use hyperlinks with a JavaScript
onClick() events. For example, to have the option to switch between two themes with
titles “boring” and “sassy,” we would use the following HTML:


 <a href="#"
      onclick="setActiveStyleSheet('boring');
      return false;">
      Boring Theme
 </a>
 <a href="#"
         onclick="setActiveStyleSheet('sassy');
         return false;">
         Sassy Theme
Finally, we attach the script that makes all this work to the html file
 </a>



     Task 4
     • Attach the “style-switcher.js” file to the “index.html” file
     • Add the hyperlinks that allow the user to switch style sheets



Resources Used
Cookie-Central < http://www.cookiecentral.com/faq/>
Webopedia.Com < http://www.webopedia.com/DidYouKnow/Internet/2002/Cookies.asp>
Adapted from Sowden, Paul. “Alternative Style: Working With Alternate Style Sheets.”
< http://www.alistapart.com/articles/alternate/>

Mais conteúdo relacionado

Mais procurados

Introduction to jquery mobile with Phonegap
Introduction to jquery mobile with PhonegapIntroduction to jquery mobile with Phonegap
Introduction to jquery mobile with PhonegapRakesh Jha
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3Gopi A
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX DesignersAshlimarie
 
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using BootstrapStop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using Bootstrapfreshlybakedpixels
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreRuss Weakley
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucksTim Wright
 
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...Evan Mullins
 
Next Steps in Responsive Design
Next Steps in Responsive DesignNext Steps in Responsive Design
Next Steps in Responsive DesignJustin Avery
 
Battle of the Front-End Frameworks: Bootstrap vs. Foundation
Battle of the Front-End Frameworks: Bootstrap vs. FoundationBattle of the Front-End Frameworks: Bootstrap vs. Foundation
Battle of the Front-End Frameworks: Bootstrap vs. FoundationRachel Cherry
 
Darwin web standards
Darwin web standardsDarwin web standards
Darwin web standardsJustin Avery
 
Introduction to jQuery Mobile - Web Deliver for All
Introduction to jQuery Mobile - Web Deliver for AllIntroduction to jQuery Mobile - Web Deliver for All
Introduction to jQuery Mobile - Web Deliver for AllMarc Grabanski
 
HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015dmethvin
 
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Nicholas Zakas
 
PrairieDevCon 2014 - Web Doesn't Mean Slow
PrairieDevCon 2014 -  Web Doesn't Mean SlowPrairieDevCon 2014 -  Web Doesn't Mean Slow
PrairieDevCon 2014 - Web Doesn't Mean Slowdmethvin
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBNeil Henegan
 
jQuery Mobile with HTML5
jQuery Mobile with HTML5jQuery Mobile with HTML5
jQuery Mobile with HTML5madhurpgarg
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Erin M. Kidwell
 

Mais procurados (20)

Bootstrap [part 2]
Bootstrap [part 2]Bootstrap [part 2]
Bootstrap [part 2]
 
Introduction to jquery mobile with Phonegap
Introduction to jquery mobile with PhonegapIntroduction to jquery mobile with Phonegap
Introduction to jquery mobile with Phonegap
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using BootstrapStop reinventing the wheel: Build Responsive Websites Using Bootstrap
Stop reinventing the wheel: Build Responsive Websites Using Bootstrap
 
CSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and moreCSS - OOCSS, SMACSS and more
CSS - OOCSS, SMACSS and more
 
Slow kinda sucks
Slow kinda sucksSlow kinda sucks
Slow kinda sucks
 
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
Custom post types- Choose Your Own Adventure - WordCamp Atlanta 2014 - Evan M...
 
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
 
Next Steps in Responsive Design
Next Steps in Responsive DesignNext Steps in Responsive Design
Next Steps in Responsive Design
 
Battle of the Front-End Frameworks: Bootstrap vs. Foundation
Battle of the Front-End Frameworks: Bootstrap vs. FoundationBattle of the Front-End Frameworks: Bootstrap vs. Foundation
Battle of the Front-End Frameworks: Bootstrap vs. Foundation
 
Darwin web standards
Darwin web standardsDarwin web standards
Darwin web standards
 
Introduction to jQuery Mobile - Web Deliver for All
Introduction to jQuery Mobile - Web Deliver for AllIntroduction to jQuery Mobile - Web Deliver for All
Introduction to jQuery Mobile - Web Deliver for All
 
HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015HTTP 2.0 - Web Unleashed 2015
HTTP 2.0 - Web Unleashed 2015
 
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
 
Jquery News Packages
Jquery News PackagesJquery News Packages
Jquery News Packages
 
PrairieDevCon 2014 - Web Doesn't Mean Slow
PrairieDevCon 2014 -  Web Doesn't Mean SlowPrairieDevCon 2014 -  Web Doesn't Mean Slow
PrairieDevCon 2014 - Web Doesn't Mean Slow
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
jQuery Mobile with HTML5
jQuery Mobile with HTML5jQuery Mobile with HTML5
jQuery Mobile with HTML5
 
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
Girl Develop It Cincinnati: Intro to HTML/CSS Class 4
 

Destaque

M Y S T E R Y O F G O D D R[1]
M Y S T E R Y  O F  G O D  D R[1]M Y S T E R Y  O F  G O D  D R[1]
M Y S T E R Y O F G O D D R[1]banothkishan
 
Fall_2008_CS601_W1_Tyngsboro
Fall_2008_CS601_W1_TyngsboroFall_2008_CS601_W1_Tyngsboro
Fall_2008_CS601_W1_Tyngsborotutorialsruby
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-startedtutorialsruby
 
photoshop-scanlines-patterns-tutorial-rev
photoshop-scanlines-patterns-tutorial-revphotoshop-scanlines-patterns-tutorial-rev
photoshop-scanlines-patterns-tutorial-revtutorialsruby
 
T H E F E T T E R S A N D T H E F R E E D O M Dr
T H E  F E T T E R S  A N D  T H E  F R E E D O M  DrT H E  F E T T E R S  A N D  T H E  F R E E D O M  Dr
T H E F E T T E R S A N D T H E F R E E D O M Drbanothkishan
 
Hitguj M A R A T H I B E S T S E L L E R O N S U P E R L I V I N G Dr
Hitguj  M A R A T H I  B E S T S E L L E R  O N  S U P E R L I V I N G  DrHitguj  M A R A T H I  B E S T S E L L E R  O N  S U P E R L I V I N G  Dr
Hitguj M A R A T H I B E S T S E L L E R O N S U P E R L I V I N G Drbanothkishan
 
Shanzhai vs. Qi Inside: Making Legal Open Source Hardware in China
Shanzhai vs. Qi Inside: Making Legal Open Source Hardware in ChinaShanzhai vs. Qi Inside: Making Legal Open Source Hardware in China
Shanzhai vs. Qi Inside: Making Legal Open Source Hardware in ChinaJon Phillips
 
Linux系统工程师教程
Linux系统工程师教程Linux系统工程师教程
Linux系统工程师教程yiditushe
 
Spring框架,技术详解及使用指导
Spring框架,技术详解及使用指导Spring框架,技术详解及使用指导
Spring框架,技术详解及使用指导yiditushe
 
D I S U N I O N I S D I S T U R B A N C E D R
D I S U N I O N  I S  D I S T U R B A N C E  D RD I S U N I O N  I S  D I S T U R B A N C E  D R
D I S U N I O N I S D I S T U R B A N C E D Rbanothkishan
 
New Study Of Gita Dec 01 Dr. Shriniwas J. Kashalikar
New Study Of Gita  Dec 01 Dr. Shriniwas J. KashalikarNew Study Of Gita  Dec 01 Dr. Shriniwas J. Kashalikar
New Study Of Gita Dec 01 Dr. Shriniwas J. Kashalikarbanothkishan
 
Walaval Dr. Shriniwas Kashalikar
Walaval Dr. Shriniwas KashalikarWalaval Dr. Shriniwas Kashalikar
Walaval Dr. Shriniwas Kashalikarbanothkishan
 
D H A R M A A N D C O S M I C D Y N A M I C S D R
D H A R M A  A N D  C O S M I C  D Y N A M I C S   D RD H A R M A  A N D  C O S M I C  D Y N A M I C S   D R
D H A R M A A N D C O S M I C D Y N A M I C S D Rbanothkishan
 
Sahastranetra A Bestseller On V I S H N U S A H A S R A N A M Dr
Sahastranetra  A  Bestseller On  V I S H N U S A H A S R A N A M  DrSahastranetra  A  Bestseller On  V I S H N U S A H A S R A N A M  Dr
Sahastranetra A Bestseller On V I S H N U S A H A S R A N A M Drbanothkishan
 
IDC Energy Insights - Enterprise Risk Management
IDC Energy Insights - Enterprise Risk ManagementIDC Energy Insights - Enterprise Risk Management
IDC Energy Insights - Enterprise Risk ManagementFindWhitePapers
 

Destaque (20)

M Y S T E R Y O F G O D D R[1]
M Y S T E R Y  O F  G O D  D R[1]M Y S T E R Y  O F  G O D  D R[1]
M Y S T E R Y O F G O D D R[1]
 
Fall_2008_CS601_W1_Tyngsboro
Fall_2008_CS601_W1_TyngsboroFall_2008_CS601_W1_Tyngsboro
Fall_2008_CS601_W1_Tyngsboro
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
photoshop-scanlines-patterns-tutorial-rev
photoshop-scanlines-patterns-tutorial-revphotoshop-scanlines-patterns-tutorial-rev
photoshop-scanlines-patterns-tutorial-rev
 
T H E F E T T E R S A N D T H E F R E E D O M Dr
T H E  F E T T E R S  A N D  T H E  F R E E D O M  DrT H E  F E T T E R S  A N D  T H E  F R E E D O M  Dr
T H E F E T T E R S A N D T H E F R E E D O M Dr
 
web20
web20web20
web20
 
Hitguj M A R A T H I B E S T S E L L E R O N S U P E R L I V I N G Dr
Hitguj  M A R A T H I  B E S T S E L L E R  O N  S U P E R L I V I N G  DrHitguj  M A R A T H I  B E S T S E L L E R  O N  S U P E R L I V I N G  Dr
Hitguj M A R A T H I B E S T S E L L E R O N S U P E R L I V I N G Dr
 
XML-Javascript
XML-JavascriptXML-Javascript
XML-Javascript
 
Shanzhai vs. Qi Inside: Making Legal Open Source Hardware in China
Shanzhai vs. Qi Inside: Making Legal Open Source Hardware in ChinaShanzhai vs. Qi Inside: Making Legal Open Source Hardware in China
Shanzhai vs. Qi Inside: Making Legal Open Source Hardware in China
 
11 30 Marketing
11 30 Marketing11 30 Marketing
11 30 Marketing
 
Linux系统工程师教程
Linux系统工程师教程Linux系统工程师教程
Linux系统工程师教程
 
prospectus
prospectusprospectus
prospectus
 
Spring框架,技术详解及使用指导
Spring框架,技术详解及使用指导Spring框架,技术详解及使用指导
Spring框架,技术详解及使用指导
 
D I S U N I O N I S D I S T U R B A N C E D R
D I S U N I O N  I S  D I S T U R B A N C E  D RD I S U N I O N  I S  D I S T U R B A N C E  D R
D I S U N I O N I S D I S T U R B A N C E D R
 
New Study Of Gita Dec 01 Dr. Shriniwas J. Kashalikar
New Study Of Gita  Dec 01 Dr. Shriniwas J. KashalikarNew Study Of Gita  Dec 01 Dr. Shriniwas J. Kashalikar
New Study Of Gita Dec 01 Dr. Shriniwas J. Kashalikar
 
Walaval Dr. Shriniwas Kashalikar
Walaval Dr. Shriniwas KashalikarWalaval Dr. Shriniwas Kashalikar
Walaval Dr. Shriniwas Kashalikar
 
git and github
git and githubgit and github
git and github
 
D H A R M A A N D C O S M I C D Y N A M I C S D R
D H A R M A  A N D  C O S M I C  D Y N A M I C S   D RD H A R M A  A N D  C O S M I C  D Y N A M I C S   D R
D H A R M A A N D C O S M I C D Y N A M I C S D R
 
Sahastranetra A Bestseller On V I S H N U S A H A S R A N A M Dr
Sahastranetra  A  Bestseller On  V I S H N U S A H A S R A N A M  DrSahastranetra  A  Bestseller On  V I S H N U S A H A S R A N A M  Dr
Sahastranetra A Bestseller On V I S H N U S A H A S R A N A M Dr
 
IDC Energy Insights - Enterprise Risk Management
IDC Energy Insights - Enterprise Risk ManagementIDC Energy Insights - Enterprise Risk Management
IDC Energy Insights - Enterprise Risk Management
 

Semelhante a Advanced Javascript Cookies

Building high performance web apps.
Building high performance web apps.Building high performance web apps.
Building high performance web apps.Arshak Movsisyan
 
Week 05 Web, App and Javascript_Brandon, S.H. Wu
Week 05 Web, App and Javascript_Brandon, S.H. WuWeek 05 Web, App and Javascript_Brandon, S.H. Wu
Week 05 Web, App and Javascript_Brandon, S.H. WuAppUniverz Org
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingAshok Modi
 
Client Building Functional webapps.
Client   Building Functional webapps.Client   Building Functional webapps.
Client Building Functional webapps.Arun Kumar
 
Introduction to web page
Introduction to web pageIntroduction to web page
Introduction to web pageMahmoud Shaqria
 
Instagram filters (8 24)
Instagram filters (8 24)Instagram filters (8 24)
Instagram filters (8 24)Ivy Rueb
 
Responsive content
Responsive contentResponsive content
Responsive contenthonzie
 
Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014Adrian Roselli
 
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentWordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentEvan Mullins
 
An Introduction to Umbraco
An Introduction to UmbracoAn Introduction to Umbraco
An Introduction to UmbracoJeremy Branham
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeededm00se
 
Instagram filters (8 24)
Instagram filters (8 24)Instagram filters (8 24)
Instagram filters (8 24)Ivy Rueb
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application developmentzonathen
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScriptkoppenolski
 
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018Esteve Castells
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to JqueryGurpreet singh
 

Semelhante a Advanced Javascript Cookies (20)

Building high performance web apps.
Building high performance web apps.Building high performance web apps.
Building high performance web apps.
 
Week 05 Web, App and Javascript_Brandon, S.H. Wu
Week 05 Web, App and Javascript_Brandon, S.H. WuWeek 05 Web, App and Javascript_Brandon, S.H. Wu
Week 05 Web, App and Javascript_Brandon, S.H. Wu
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
 
Client Building Functional webapps.
Client   Building Functional webapps.Client   Building Functional webapps.
Client Building Functional webapps.
 
Introduction to web page
Introduction to web pageIntroduction to web page
Introduction to web page
 
Web technologies part-2
Web technologies part-2Web technologies part-2
Web technologies part-2
 
Instagram filters (8 24)
Instagram filters (8 24)Instagram filters (8 24)
Instagram filters (8 24)
 
Responsive content
Responsive contentResponsive content
Responsive content
 
Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014Making Your Site Printable: CSS Summit 2014
Making Your Site Printable: CSS Summit 2014
 
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to DevelopmentWordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
WordCamp Greenville 2018 - Beware the Dark Side, or an Intro to Development
 
An Introduction to Umbraco
An Introduction to UmbracoAn Introduction to Umbraco
An Introduction to Umbraco
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
Instagram filters (8 24)
Instagram filters (8 24)Instagram filters (8 24)
Instagram filters (8 24)
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScript
 
What is HTML 5?
What is HTML 5?What is HTML 5?
What is HTML 5?
 
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
Advanced Web Scraping or How To Make Internet Your Database #seoplus2018
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
Site Manager rocks!
Site Manager rocks!Site Manager rocks!
Site Manager rocks!
 

Mais de tutorialsruby

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>tutorialsruby
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 

Mais de tutorialsruby (20)

&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
TopStyle Help &amp; &lt;b>Tutorial&lt;/b>
 
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
The Art Institute of Atlanta IMD 210 Fundamentals of Scripting &lt;b>...&lt;/b>
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0Standardization and Knowledge Transfer – INS0
Standardization and Knowledge Transfer – INS0
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml_basics
xhtml_basicsxhtml_basics
xhtml_basics
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
xhtml-documentation
xhtml-documentationxhtml-documentation
xhtml-documentation
 
CSS
CSSCSS
CSS
 
CSS
CSSCSS
CSS
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa0602690047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
0047ecaa6ea3e9ac0a13a2fe96f4de3bfd515c88f5d90c1fae79b956363d7f02c7fa060269
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
HowTo_CSS
HowTo_CSSHowTo_CSS
HowTo_CSS
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Último

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 

Último (20)

Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 

Advanced Javascript Cookies

  • 1. Advanced Javascript Webworks – A Workshop Series in Web Design (Session 5) Table of Contents: 1. Browser and Object detection 2. Cookies and Stylesheets Browser and Object Detection 1. Introduction There are many browsers out in the great unknown of the internet today. Internet Explorer, Netscape, Mozilla Firefox, and Opera are just a few of them, and even they have internal version numbers as well. As you can imagine, each has slightly different, or even vastly different, ways of interpreting your JavaScript or HTML code. Some HTML tags are supported in some but not in others. Not all browsers support the same version of JavaScript. Some functions may be support on one browser, but not on the next. Displayed text or boxes could even look misaligned. How can you limit the number of bugs on your page? 2. Browser Detection vs Object Detection Browser detection sniffs out the browser of the entire page, while object detection is a more dynamic way of checking the validity of each function as it gets called. Browser detection leverages the navigator object that is available to all JavaScript code, and while it had its glory days, object detection is now the more popular way to sniff out incompatibility. First, we’ll go over browser detection. 3. Browser Detection Browser detection was widely popular in the past. JavaScript gets a “navigator” object, from which browser data can be collected. Useful properties: Property Description Navigator.appName Name of the browser (for ex, Microsoft Internet Explorer Navigator.appVersion Version of the browser (for ex, 6.0) Navigator.userAgent User agent header (for ex, Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Hotbar 3.0)) For example, <script language="JavaScript" type="text/JavaScript"> if(navigator.appName == "Netscape"){ window.location = "http://www.netscape.com" } if(navigator.appName == "Microsoft Internet Explorer"){ window.location = "http://www.msn.com" } window.location == "meh.html" </script>
  • 2. Webworks: Advanced Javascript Page 2 of 9 So, we could use this to set up many variables that detect the browser type and version, and then use this to either detect which version of our code to use, or to phase out parts of our code that might not work under other browsers. 4. Object Detection So what’s the problem with using browser detection? Well, as you can see, it’s pretty tedious. Many browsers hide their names or have different formats for displaying version numbers. You can to check for every browser, and since there are so many different kinds, it’s almost impossible to preplan for each. Besides, who wants to do that? Here’s where object detection comes in. It actually figures out whether the visiting browser supports the object that is going to be used before it uses it. Let’s look at the classic rollover example. Rollovers use the document.images object to get the images on a page. However, this object is only supported by Netscape 3+ and IE 4+. Here’s how to do it: function imgOn(imgName) { if (document.images) { document[imgName].src = eval(imgName + "ON").src; } } Notice that I called the object, document.images. If it exists, it will return true and execute the following code. Notice that if it does not exist, the code will continue as if nothing had happened. Cookies – Quick Overview What are They? A very small text file placed on your hard drive by a web page server when you access a site on that server. It serves as an identification the next time you access web pages on that server so as to extend the capabilities of web- based client/server applications. It is uniquely yours and can only be read by the server that gave it to you. What are They For? To let the server know that you have returned to a page/site you have previously visited. This can be useful in the following situations: • Suppose you are filling a form and then accidentally close the window. A cookie set on your machine lets the server remember fields already filled-out. • Allows you to customize what you want to see
  • 3. Webworks: Advanced Javascript Page 3 of 9 when you visit a portal like myway.com • Monitors which advertisements were shown to you and how often each was shown. Types of Cookies There are two types: • Session cookies – expire after your session on that site • Persistent cookies – remain until you clear your cache and delete cookies Types of Values a Cookie can Pass • The name of the cookie. • The value of the cookie. • The expiration date of the cookie - how long the cookie is active in your browser. • The path of the cookie is valid for - the URL path the cookie us valid in. Web pages outside of that path cannot use the cookie. • The domain the cookie is valid for - makes the cookie accessible to pages on any of the servers on a multi-server domain. • The need for a secure connection – states if the cookie can only be used on a secure server connection, such as on a site using SSL. Let’s Bake some Cookies Stage 1 – Cascading Style-Sheets Task 1 • Visit CSS-Zen Garden <http://www.csszengarden.com/> • Click on any of the links to the left and observe the content of the pages As you might have observed, although the index pages all have the same text, their formatting and layouts differ radically. Each uses a Cascading Style-Sheet (CSS). Questions: • What is a style-sheet? • Do you find all the layouts equally appealing? • What is the chance that everyone finds your favorite one most appealing? Stage 2 – Creating the Style-Sheets Lets now apply the knowledge about cookies to allow each one of us to be able select how they want their site to be displayed. But first we need to have a style-sheet created for each new look we want to make available.
  • 4. Webworks: Advanced Javascript Page 4 of 9 In real life you would do this when you start designing your site. If you want to learn more about style-sheets, use Google, visit WC3.org (http://www.w3.org/Style/CSS/) or come to our Spring CSS tutorial. For now: Task 2 • Download and unzip cookies.zip to the desktop • Open the index file for editing in Macromedia DreamWeaver. Stage 3 – Attaching the Style-Sheets to the Page The link element is used to declare the style-sheet. There are three different relationships external style sheets can have with their parent document: persistent, preferred, and alternate. Persistent Sheets Always on. To make a style sheet persistent, the rel attribute is set to “stylesheet” and NO title attribute is set. To make the style sheet “style1.css” persistent, add this code in the head: <link rel="stylesheet" type="text/css" href="style1.css" /> Preferred Sheets These style sheets are enabled by default. They can, however, be disabled them if an alternate style sheet is selected. To make a style sheet preferred, the rel attribute is set to “stylesheet” and the style sheet is given a title attribute. For instance, this code makes sheet “style2.css” preferred. <link rel="stylesheet" type="text/css" href="style2.css" title="preferred"/> Note: It is preferred not because its title is “preferred” but because it has a title. Style sheets having identical title attributes are form a group. Grouped sheets can be enabled and disabled in one go. If more than one group of preferred style sheets are declared, the first group takes precedence. Alternate Sheets These style sheets can be selected by the visitor as an alternatives to the author’s preferred style sheet. This allows the visitor to personalize a site and choose his or her favorite scheme. They can also be used for accessibility.
  • 5. Webworks: Advanced Javascript Page 5 of 9 To specify an alternate style sheet, the rel attribute is set to “alternate stylesheet” and the style sheet is named with a title attribute. As with preferred sheets, these style sheets can also be grouped together by giving them identical title attributes. To make style-sheet “style3.css” an alternate sheet, we place this code in the head of the document. <link rel="alternate stylesheet" type="text/css" href="style2.css" title="alternate" /> Task 3 • There are three style-sheets in the cookie folder you created from the zip- file you downloaded. • Add sheets “style1.css”, “style2.css” and “style3.css” to the head of your “index.html“ file • Make sheet “style1.css” the persistent sheet. • Make sheet “style2.css” the preferred sheet entitled “sassy” • Make sheet “style3.css” the alternate sheet entitled “boring” Swapping Styles Stage 4 – Programmatically Differentiating Sheets Ideally, users should be able to select the style-sheet of their choice from the available list. Sadly, this is not the case so we have to use JavaScript to allow users to make that choice and remember it for them using a cookie. The Script First we need the script to be able to differentiate between the three different types of style-sheet. This is relatively easy to do, as we only need to check two of the attributes of each link element. Is it a link to a style sheet? HTMLLinkElement.getAttribute("rel").indexOf("style") != -1 Is there a title attribute? HTMLListElement.getAttribute("title") Does the rel attribute contain the keyword "alternate"? HTMLLinkElement.getAttribute("rel").indexOf("alt") != -1
  • 6. Webworks: Advanced Javascript Page 6 of 9 Using these three checks we can check every link element in the document, disabling all preferred and alternate style sheets that we don’t want active, and enabling all preferred and alternate style sheets that we do want active. Note: Only preferred and alternate style sheet link elements have a title attribute. The function to do this looks like this: function setActiveStyleSheet(title) { var i, a, tagNames; tagNames = document.getElementsByTagName("link"); for(i=0; i < tagNames.length; i++) { a = tagNames[i]; if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { a.disabled = true; if(a.getAttribute("title") == title) a.disabled = false; } } } Stage 5 - Baking Cookies Now we can change the style sheet. However, the preference only persists on the current page. To remember the preference, we use cookies. Cookie processing involves storing the preference to the hard-drive in the form of a cookie and reading it another time. The following snippet creates a cookie. function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else expires = ""; document.cookie = name+"="+value+expires+"; path=/"; }
  • 7. Webworks: Advanced Javascript Page 7 of 9 To read the cookie we use this snippet function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } Stage 6 - Getting the Current Active Style-sheet To return the current style sheet we locate an active preferred or alternate style sheet and check its title. To do this we look at all link elements on the page to decide if each is a style sheets. If it is, we check if has a title. This tells us that the style sheet is either preferred or alternative. Finally, we check if the style sheet is active. If all three checks return true, we have the current style sheet and we can return the title. If not, then we return null. The function looks like this: function getActiveStyleSheet() { var i, a, tagNames; tagNames = document.getElementsByTagName("link"); for(i=0; i < tagNames.length; i++) { a = tagNames[i]; if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title"); } return null; }
  • 8. Webworks: Advanced Javascript Page 8 of 9 Stage 5 - Using the Cookies To use these cookie functions, we need to add onload() and onUnload() event listener handles to the window. OnLoad() When document is loaded, we need to tell the browser which style-sheet (our preferred style-sheet) we want to use as our active style-sheet. The function setActiveStyleSheet() (see page4) does this. To find out which style sheet is the preferred style sheet, we need another function - getActiveStyleSheet() which may look like this: function getPreferredStyleSheet() { var i, a, tagNames; tagNames = document.getElementsByTagName("link"); for(i=0; i < tagNames.length; i++) { a = tagNames[i]; if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title") ) return a.getAttribute("title"); } return null; } In the onload() function, we first set a title variable. This either holds the value of the previous style sheet that was retrieved from the cookie, or if there isn’t one, the title of the author’s preferred style sheet. To keep things logical, let’s call the cookie “style.” Next we call up the setActiveStyleSheet() function passing the title variable as the title. Our onload function looks something like this: window.onload = function(e) { var cookie = readCookie("style"); var title = cookie ? cookie : getPreferredStyleSheet(); setActiveStyleSheet(title); }
  • 9. Webworks: Advanced Javascript Page 9 of 9 onUnload() When we leave the page, we want to remember the style-sheet for another day, so we save it. We use the onUnload listener message handle to do this. This function gets the current active style-sheet, and saves it in a cookie: window.onunload = function(e) { var title = getActiveStyleSheet(); createCookie("style", title, 365); } Stage 6 - Integrating it all We store all these functions in a JavaScript file named styleswitcher.js, and load the file inside the head of the document, making sure the script file is loaded after all the style-sheet link elements like this: <script type="text/JavaScript" src="styleswitcher.js"></script> To allow visitors to change the active style sheet, we use hyperlinks with a JavaScript onClick() events. For example, to have the option to switch between two themes with titles “boring” and “sassy,” we would use the following HTML: <a href="#" onclick="setActiveStyleSheet('boring'); return false;"> Boring Theme </a> <a href="#" onclick="setActiveStyleSheet('sassy'); return false;"> Sassy Theme Finally, we attach the script that makes all this work to the html file </a> Task 4 • Attach the “style-switcher.js” file to the “index.html” file • Add the hyperlinks that allow the user to switch style sheets Resources Used Cookie-Central < http://www.cookiecentral.com/faq/> Webopedia.Com < http://www.webopedia.com/DidYouKnow/Internet/2002/Cookies.asp> Adapted from Sowden, Paul. “Alternative Style: Working With Alternate Style Sheets.” < http://www.alistapart.com/articles/alternate/>