Book Image

Learning Dojo

By : Peter Svensson
Book Image

Learning Dojo

By: Peter Svensson

Overview of this book

<p>Dojo is a popular AJAX-specific open-source JavaScript framework for building powerful web applications. It provides a well conceived API and set of tools to assist you and fix the issues experienced in everyday web development. Your project size is no concern while using Dojo. It is the best scalable solution to all your size-related issues.<br /> <br />This book starts by giving you tips and tricks for programming with JavaScript. These tricks will help you with Dojo. With every chapter, you will learn advanced JavaScript techniques. You will learn to leverage Dojo for a clean web application architecture using JSON or XML.</p>
Table of Contents (13 chapters)
Learning Dojo
Credits
About the Author
About the Reviewer
Preface
Free Chapter
1
Introduction to Dojo

Script request/JSONP (dojo.io.script)


One of the most basic tenets of browser security is the same-domain policy, which enforces the rule that a page loaded from one domain may not connect to any other domain. This rule is enforced by all major browsers, so that a malicious script that might have been injected at some point in the server cannot stealthily connect to a remote server and transmit sensitive details about the user (or worse).

There are, in fact, three exceptions to this rule, and those are CSS files, image files (gif, png, jpeg, and so on), and JavaScript files. That's right, it's perfectly legal to load an HTML page from domain x and have it in turn load JavaScript files from domainy.

In fact, without that feature, it wouldn't be possible to load and use AOL's CDN to load Dojo in the examples in this book.

But maybe you know this and have tried to use Dojo's XHR methods to load resources on remote servers which are encoded as JSON like the Yahoo Search API. Dojo does allow that...