Web Info & Tutorials

November 21st, 2007

WIKIPEDIA OFFLINE WITH GEARSMONKEY

Working on the Gears team we also run across applications that we would love to take offline. A lot of these applications aren’t Google’s so we thought it would be nice to be able to take third party apps offline. This also makes sense since Aaron Boodman (Mr. Greasemonkey) is co-tech lead on Gears itself!

Ben Lisbakken has written up his work taking Gears and Greasemonkey to make this happen. He details the real example of taking Wikipedia offline which has once piece of narly code to do with iframe injection to be able to store data on third party sites (e.g. media site vs. wikipedia main site):

  1. Initialize Gears on page
    • Check if site has been allowed, if not, trigger allow dialog
  2. Insert iFrame
  3. Initialize Gears on iFrame
    • Check if site has been allowed, if not, trigger allow dialog
  4. If Gears is initialized on both, insert Cache Page link (unless page is cached)
  5. When user clicks Cache Page:
    • Capture the HTML and CSS of the Main Page
    • Store the URLs of all links to HTML, CSS, and media files in the Gears database (so we can remove them from the ResourceStore later, if needed)
    • Create an iFrame whose src is in the domain of upload.wikimedia.org. Pass all media file URLs to the iFrame in the src URL after the hash, e.g. src=”http://upload.wikimedia.org/#thisimgloc.jpg||anotherimgloc.jpg||lastimgloc.jpg”
    • Initialize Gears in iFrame
    • Capture all URLs from the iFrame’s href hash.
  6. When user clicks [x] to remove an article from cache:
    • Grab all URLs from the Gears database that correspond to that article
    • Remove all URLs from the ResourceStore of the Main Page that contain the string “en.wikipedia.org”
    • Remove all URLs from the Gears database that correspond to that article
    • Create an iFrame whose src is in the domain of upload.wikimedia.org. Pass all media file URLs to the iFrame in the src URL after the hash, e.g. src=”http://upload.wikimedia.org/#thisimgloc.jpg||anotherimgloc.jpg||lastimgloc.jpg||remove||”
    • Initialize Gears in iFrame
    • Remove all URLs from the ResourceStore that are listed in the iFrame’s href hash.

Here’s the script in action as I save pages away. This is just the beginning. Ideally we would have the code automatically save content that you have been too, and do smart spidering to get more on the subject too. We will also work on making GearsMonkey scripts even easier to write.


November 21st, 2007

SWFADDRESS 2.0: DEEP LINKING FOR FLASH AND AJAX

SWFAddress 2.0 has been released:

SWFAddress is a small, but powerful library that provides deep linking for Flash and Ajax. It’s a developer tool, allowing creation of unique virtual URLs that can point to a website section or an application state. SWFAddress enables a number of important capabilities which are missing in today’s rich web technologies including:

  • Bookmarking in a browser or social website
  • Sending links via email or instant messenger
  • Finding specific content with the major search engines
  • Utilizing browser history and reload buttons

What’s new in 2.0

  • Support for multiple Flash movies and Ajax.
  • Event listeners for ActionScript and JavaScript.
  • New SWFAddressEvent class with support for INIT and CHANGE types.
  • New unobtrusive SEO technique.
  • Support for Adobe Flash CS3.
  • Support for Flash Player 7 with the Flash/JavaScript Integration Kit.
  • Support for SWFObject 2.0, UFO and Adobe’s Active Content embedding.
  • New strict mode that adds trailing slashes by default.
  • New helper methods for link, window and popup management.
  • Ability to configure the script with query parameters.
  • The swfaddress.html is optional and not used by default.
  • Lots of new and improved Flash based samples.
  • Various optimizations and fixes.
  • API docs for ActionScript 3 and JavaScript.

There are a whole slew of samples, including Ajax specific ones.

November 21st, 2007

CROSS DOMAIN XHR W3C PROPOSAL

The W3C has a newborn offering named Enabling Read Access for Web Resources which defines admittance curb primitives to be utilised for interbreed field XHR.

You crapper ordered curb via a protocol header:

HTML:

  1.  
  2. Access-Control: earmark <*.example.org> eliminate <*.public.example.org>
  3.  

or an XML processing instruction:

XML:

  1.  
  2. <?access-control allow=“allow.example.org” deny=“deny.example.org”?>
  3.  

so no cross_domain.xml.

Kris Zyp has cursive up his thoughts on the proposal:

A sort of things to see most this proposal:

  • It does not create some newborn vulnerabilities with existing servers. Cross field XHR module ever change with existing servers until they hit specifically additional headers to delimitate the admittance control. In another text it doesn’t add newborn vulnerabilities to the web, kinda it allows those who poverty to add interbreed place admittance the knowledge to cod it in a bonded behavior without hacks same JSONP or separate identifier messaging.
  • Both GET and POST crapper currently be executed interbreed place with scripts tags or modify submission, so some threats much as CSRF and DOS already exist, the offering does not inform them.
  • The offering states that cookies should be distant from interbreed place requests. This module turn the incident of interbreed place letter forgery, and forces developers to ingest more bonded definitive forms of marker maintanence.
  • Developers that earmark interbreed place admittance ease staleness secure that they are not providing favored aggregation to sites that should not be accessing the information. Developers that earmark POST and another modifying dealings should verify similiar precautions.
  • This provides a fine-grained admittance curb level. When servers delimitate admittance curb headers that earmark interbreed place access, they crapper take which scheme tender domains are allowed to admittance their resources.

Kris also has a comparability with JSON approaches:

Cross Domain JSON Comparison

The set XMLHttpRequest goal itself has also seen a past newborn draft.

November 21st, 2007

FIREFOX 3 BETA: FONTS AND COLORS

Firefox 3 beta 1 is in the wild for developers to test with:

  • Improved security features such as: better presentation of website identity and security, malware protection, stricter SSL error pages, anti-virus integration in the download manager, and version checking for insecure plugins.
  • Improved ease of use through: better password management, easier add-on installation, new download manager with resumable downloading, full page zoom, animated tab strip, and better integration with Windows Vista and Mac OS X.
  • Richer personalization through: one-click bookmarking, smart search bookmark folders, direct typing in location bar searches your history and bookmarks for URLs and page titles, ability to register web applications as protocol handlers, and better customization of download actions for file types.
  • Improved platform features such as: new graphics and font rendering architecture, major changes to the HTML rendering engine to provide better CSS, float-, and table layout support, native web page form controls, colour profile management, and offline application support.
  • Performance improvements such as: better data reliability for user profiles, architectural improvements to speed up page rendering, over 300 memory leak fixes, and a new XPCOM cycle collector to reduce entire classes of leaks.

Stuart Parmenter has discussed what he is excited about which includes:

  1. Vastly improved font selection and complex script support.
    - I’ll be going in to more detail than you probably wanted to know on the improvements here soon.
  2. Color profile support for images and CSS colors
    - This is disabled by default currently. We still need to add prefs for it. Set gfx.color_management.enabled to true in about:config and restart the browser to enable.

Both of these are fairly subtle improvements but should both make a big improvement to large sets of people.

While I’m really excited about this milestone, I think the memory work currently going on will make the next couple betas that much better.