Frequently asked questions about interfaces, languages and Ajax

Ajax

Interface and languages

XML, RDF, RSS

A question? Write it on the new dynamic commenting system ...

Ajax

Why use Ajax?

Ajax suppresses delays when data is loaded from the server to change the content of the page, and updates it smoothly without flicking.
But the use of an Ajax framework goes beyond that and allows to build complete web applications with GUI.

What have I to know to use Ajax?

Dynamic HTML components allow to make an Ajax application so smooth and ease to build a website: JavaScript, DOM, CSS.
And also, the XMLHttpRequest object has to been knows: it is made of a small set of attributes and methods and makes use of http methods: GET, POST, HEAD, PUT, DELETE.

Is the XMLHttpRequest object part of a W3C standard?

Yes. The working draft is available at W3C and will be turned to a recommandation once finished.

Do I have to use XML in an Ajax application?

Although XML is used to make the name Ajax, it is an option and not a necessity and we can also use files in text format, and therefore files in JSON format which is textual and provides a simplified alternative to XML.

When launching the Ajax request, the object created as an instance of XMLHttpRequest has two attributes that are assigned with the server's response:

    1. responseText containing a text document.
    2. responseXML containing an XML document whose tags can be accessed thought DOM.

responseText may contain a JSON file, which represents the data more concisely than XML and has the advantage of being directly usable by JavaScript, because it is similar to the definition of an array.
But it must be evaluated by JavaScript to be assigned to a variable.

The code will have this form:

function demo () 
{ 
     if (req.readyState == 4) 
     { 
          var x = eval ( '(' + req.responseText +')'); 
     }
}

The x variable contains an array filled with the data from the JSON file.

Do I have to use GET or POST?

GET is used to receive data from the server, POST is used to send data.

What can I do with the file loaded by XMLHttpRequest?

This depend upon the format of the file:
- if it is a text file, it is assigned to a variable and used as a string.
- for an XML file, the content of responseXML is also assigned to a variable and the content is accessed by the DOM's methods.
- if it is in the JSON format it is parsed by the eval() function.

What is JSON?

JSON (pronounce Jason) is a file format that is recognized by the JavaScript standard, since 1999. It is very simple and intended for exchanging data between the browser and the server.

What is a user agent?

It may be a web browser, a search engine crawler, or any kind of client application which accesses the Web. In the HTTP protocol, the user agent that sends the request is identified by a string starting with the "User-Agent:" attribute followed by the application name, version, OS, human language, etc... Examples:
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 SeaMonkey/1.0.4
User-Agent:Googlebot/2.1 (+https://www.google.com/bot.html)

What are the benefits of XMLHttpRequest over IFrame?

IFrame is another mean for changing a web page instantaneously without reloading it, with data taken from the server, but the XMLHttpRequest object has the following benefits:
- It allows exchanging XML file with the server, that become accessible with the DOM interface, IFrame doesn't.
- It is faster and easier then IFrame.
- It has the abort() function.
- Numerous frameworks are dedicated to Ajax.
IFrame should be used only when XHR is not available, on older Web browsers for example.

Can I use Ajax locally, without server?

The XMLHttpRequest object works locally without complete feedback. The readyState property always returns 4 and status is not the value returned by a server. You can load documents and process them with JavaScript.

Can I drop Flash with the help of Ajax?

Flash is an animation technology before being a mode of interaction with the server and a tool for making interface. It offers vector drawing and a scripting language, ActionScript. It allows dynamic pages, animations, games. All that can be replaced by:

Interface languages

What is predictive interface?

This concept is used by the software Mathematica in version 9. This is to adapt the interface according to the user's needs and when it passes commands to the program, the interface adaptsand offers new useful commands in this opened context.

What is XUL?

XUL (pronounce Zool) means for XML-based User interface language, and is a mean to design graphical user interface with XML tags.
It was originally defined to build the interface of Mozilla and now may be used standalone with the XULRunner runtime.

It is the interface language for Firefox extensions.

Is it easier to use XUL rather than GTK or Visual Studio?

The code of a graphical interface described in XUL is more readable than the GTK counterpart or the code produced by Visual Studio or any other IDE. A part of code may be moved just as a part of text, and that works!
Building an application with an IDE is simpler than typing directly the code, of course, but once a complete IDE for Xul available (see XulDev), XUL will be better because it is more powerful than classical GUIs.

Where to find a tutorial for XUL?

A XUL tutorial is available on this site. And another on Mozilla.

What is Canvas?

It is a tag allowing the user to draw on the screen and the programmer to build new elements for XUL.
Not to be confused with the Canvas tag of the new version of HTML. Canvas has sub-element as box has, and CSS properties.
The tutorial.

What is XAML?

XAML is the XUL counterpart from Microsoft (c) for the Vista operating system, successor of Windows XP. XAML, (pronounce Zammel), means for "eXtensible Application Markup Language". XAML works under the .net environment, not in native mode, it is simpler than XUL but is not cross-platform.
See how XAML differ of XUL on this page.

Can I use XAML on any computer?

XAML is the main part of WPF, and runs under .Net and thus under Mono for Linux.
It is also the interface language of Windows 8 for the modern tiled interface, previously called Metro.

What is WPF?

WPF (Windows Presentation Foundation) is the graphical layer of the Vista operating system. It is available for XP also as part of WinFX, an extension to the .Net framework.
It is intended both for local applications and as graphical interface for web services, available through Internet Explorer.

What is WPF/E?

WPF/E (Windows Presentation Foundation Everywhere) was the code-name of Silverlight.

XML, RDF, RSS

What is XML?

XML means for de eXtended Markup Language, it describes and analyzes data with tags.

What is RDF?

For RDF, data are resources for the program that uses them. RDF is a standard to describe data used by a program, and it serves to fill lists and trees or provide textual information to any graphical widgets. It is used to localize programs. The structure of widgets has a counterpart in the structure of the RDF file.
More details on the RDF page.

Why to use RDF rather than XML?

Using XML to describe data used by a program is possible. But we have to define tags and write a library to process them. RDF has a built-in library, and since it is a standard, we know how to build the file of resources for any program.

Which version of RSS should I use?

The two most frequently used format, and therefore the most efficient to promote the content of a website are RSS 2.0 and Atom. For example, these two formats are recognized by Google for a sitemap of your website.

How to make the feed accessible to browsers?

To make the feed accessible to browsers, insert the following lines in the head section of the HTML code of your homepage:

<link rel="alternate"  type="application/rss+xml" href="https://www.xul.fr/rss.xml" title="Feed in RSS format for Xul">
<link rel="alternate"  type="application/atom+xml" href="https://www.xul.fr/atom.xml" title="Feed in Atom format for Xul">

The first line is for the RSS format and the second one for the Atom format. Replace the URL by your domain. The header of your HTML page then looks like this:

<head>
 <title>Xul.fr, title of the site</title> 
    <link rel="stylesheet" type="text/css" href="xul.css" >
    <link rel="alternate"  type="application/rss+xml" href="https://www.xul.fr/rss.xml" title="Feed in RSS format for Xul">
    <link rel="alternate"  type="application/atom+xml" href="https://www.xul.fr/atom.xml" title="Feed in Atom format for Xul">
</head>

How do people will find my RSS feed?

Once your RSS feed built, as explained in the RSS tutorial on this site, it must be pointed out by an orange button, showing the XML or RSS text. The feed will be extracted for readers with an RSS aggregator, or with Internet Explorer 7 by a click on an icon.
You can also add the URL of your feed on Yahoo or Google, and also on directories as Dmoz.org. A lot of websites is dedicated to publish lists of RSS feeds.
© 2006-2017 Xul.fr