|
|
|
The General Ajax Interview Questions consists the most frequently asked
questions in Ajax. This list of 100+ questions guage your familiarity with
the Ajax platform. The q&a have been collected over a period of time
from various blogs, forums and other similar Php sites
|
3. Ajax Interview Questions Part[3]
|
| 3.1 What
Browsers does HTML_AJAX work with?
|
| 3.2 Is Ajax
just another name for XMLHttpRequest?
|
| 3.3 How do I
abort the current XMLHttpRequest?
|
| 3.4 What is
the minimum version of PHP that needs to be running in order to use HTML_AJAX?
|
| 3.5 Why does
HTML_AJAX hang on some server installs
|
| 3.6 How do I
get the XMLHttpRequest object?
|
| 3.7 Are there
any security issues with AJAX?
|
| 3.8 What
about applets and plugins ?
|
| 3.9 Why did
you feel the need to give this a name?
|
| 3.10 10Techniques
for asynchronous server communication have been around for years. What makes
Ajax a “new” approach?
|
| 3.11 Ajax a
technology platform or is it an architectural style?
|
| 3.12 How
does HTML_AJAX compare with the XAJAX project at Sourceforge?
|
| 3.13 What
browsers support AJAX?
|
| 3.14 Will
HTML_AJAX integrate with other Javascript AJAX libraries such as scriptaculous
? How would this integration look like?
|
| 3.15 15 When
should I use an Java applet instead of AJAX?
|
| 3.16 What
kinds of applications is Ajax best suited for?
|
| 3.17 Does
this mean Adaptive Path is anti-Flash?
|
| 3.18 Where
can I find examples of AJAX?
|
| 3.19 What is
the XMLHttpRequest object?
|
| 3.20 How do
I access data from other domains to create a mashup with Java?
|
3.1 What Browsers does HTML_AJAX work with?
|
|
As of 0.3.0, all the examples that ship with HTML_AJAX have been verified to
work with
* Firefox 1.0+
* Internet Explorer 5.5+ (5.0 should work but it hasn't been tested) Most
things work with
* Safari 2+
* Opera 8.5+
|
3.2 Is Ajax just another name for XMLHttpRequest?
|
|
No. XMLHttpRequest is only part of the Ajax equation. XMLHttpRequest is the
technical component that makes the asynchronous server communication possible;
Ajax is our name for the overall approach described in the article, which
relies not only on XMLHttpRequest, but on CSS, DOM, and other technologies.
|
3.3 How do I abort the current XMLHttpRequest?
|
|
Just call the abort() method on the request.
|
3.4 What is the minimum version of PHP that needs to be running in order to use
HTML_AJAX?
|
|
The oldest PHP version i've fully tested HTML_AJAX is 4.3.11, but it should run
on 4.2.0 without any problems. (Testing reports from PHP versions older then
4.3.11 would be appreciated.)
|
3.5 Why does HTML_AJAX hang on some server installs ?
|
|
If you run into an HTML_AJAX problem only on some servers, chances are your
running into a problem with output compression. If the output compression is
handled in the PHP config we detect that and do the right thing, but if its
done from an apache extension we have no way of knowing its going to compress
the body. Some times setting HTML_AJAX::sendContentLength to false fixes the
problem, but in other cases you'll need to disabled the extension for the AJAX
pages. I've also seen problems caused by debugging extensions like XDebug,
disabling the extension on the server page usually fixes that. Questions
dealing with Using HTML_AJAX, and general JavaScript development
|
3.6 How do I get the XMLHttpRequest object?
|
|
Depending upon the browser... if (window.ActiveXObject) { // Internet Explorer
http_request = new ActiveXObject("Microsoft.XMLHTTP"); } else if...
|
3.7 Are there any security issues with AJAX?
|
|
JavaScript is in plain view to the user with by selecting view source of the
page. JavaScript can not access the local filesystem without the user's
permission. An AJAX interaction can only be made with the servers-side
component from which the page was loaded. A proxy pattern could be used for
AJAX interactions with external services. You need to be careful not to expose
your application model in such as way that your server-side components are at
risk if a nefarious user to reverse engineer your application. As with any
other web application, consider using HTTPS to secure the connection when
confidential information is being exchanged.
|
3.8 What about applets and plugins ?
|
|
Don't be too quick to dump your plugin or applet based portions of your
application. While AJAX and DHTML can do drag and drop and other advanced user
interfaces there still limitations especially when it comes to browser support.
Plugins and applets have been around for a while and have been able to make
AJAX like requests for years. Applets provide a great set of UI components and
APIs that provide developers literally anything. Many people disregard applets
or plugins because there is a startup time to initialize the plugin and there
is no guarantee that the needed version of a plugin of JVM is installed.
Plugins and applets may not be as capable of manipulating the page DOM. If you
are in a uniform environment or can depend on a specific JVM or plugin version
being available (such as in a corporate environment) a plugin or applet
solution is great. One thing to consider is a mix of AJAX and applets or
plugins. Flickr uses a combination of AJAX interactions/DHTML for labeling
pictures and user interaction and a plugin for manipulating photos and photo
sets to provide a great user experience. If you design your server-side
components well they can talk to both types of clients.
|
3.9 Why did you feel the need to give this a name?
|
|
I needed something shorter than “Asynchronous JavaScript+CSS+DOM+XMLHttpRequest”
to use when discussing this approach with clients.
|
3.10 10Techniques for asynchronous server communication have been around for
years. What makes Ajax a “new” approach?
|
|
What’s new is the prominent use of these techniques in real-world applications
to change the fundamental interaction model of the Web. Ajax is taking hold now
because these technologies and the industry’s understanding of how to deploy
them most effectively have taken time to develop.
|
3.11 Is Ajax a technology platform or is it an architectural style?
|
|
It’s both. Ajax is a set of technologies being used together in a particular
way.
|
3.12 How does HTML_AJAX compare with the XAJAX project at Sourceforge?
|
|
XAJAX uses XML as a transport for data between the webpage and server, and you
don't write your own javascript data handlers to manipulate the data received
from the server. Instead you use a php class and built in javascript methods, a
combination that works very similiar to the HTML_AJAX_Action class and
haSerializer combo. XAJAX is designed for simplicity and ease of use. HTML_AJAX
allows for multiple transmission types for your ajax data - such as
urlencoding, json, phpserialized, plain text, with others planned, and has a
system you can use to write your own serializers to meet your specific needs.
HTML_AJAX has a class to help generate javascript (HTML_AJAX_Helper) similiar
to ruby on rail's javascript helper (although it isn't complete), and an action
system similiar to XAJAX's "action pump" that allows you to avoid writing
javascript data handlers if you desire. But it also has the ability to write
your own data handling routines, automatically register classes and methods
using a server "proxy" script, do different types of callbacks including
grabbing remote urls, choose between sync and async requests, has iframe
xmlhttprequest emulation fallback capabilities for users with old browsers or
disabled activeX, and is in active development with more features planned (see
the Road Map for details) HTML_AJAX has additional features such as client
pooling and priority queues for more advanced users, and even a javascript
utility class. Although you can use HTML_AJAX the same way you use XAJAX, the
additional features make it more robust, extensible and flexible. And it is a
pear package, you can use the pear installer to both install and keep it up to
date. If you're asking which is "better" - as with most php scripts it's a
matter of taste and need. Do you need a quick, simple ajax solution? Or do you
want something that's flexible, extensible, and looking to incorporate even
more great features? It depends on the project, you as a writer, and your
future plans.
|
3.13 What browsers support AJAX?
|
|
Internet Explorer 5.0 and up, Opera 7.6 and up, Netscape 7.1 and up, Firefox 1.0
and up, Safari 1.2 and up, among others.
|
3.14 Will HTML_AJAX integrate with other Javascript AJAX libraries such as
scriptaculous ? How would this integration look like?
|
|
HTML_AJAX doesn't have specific plans to integrate with other JavaScript
libraries. Part of this is because external dependencies make for a more
complicated installation process. It might make sense to offer some optional
dependencies on a library like scriptaculous automatically using its visual
effects for the loading box or something, but there isn't a lot to gain from
making default visuals like that flashier since they are designed to be easily
replaceable.
|
3.15 When should I use an Java applet instead of AJAX?
|
|
Applets provide a rich experience on the client side and there are many things
they can do that an AJAX application cannot do, such as custom data streaming,
graphic manipulation, threading, and advanced GUIs. While DHTML with the use of
AJAX has been able to push the boundaries on what you can do on the client,
there are some things that it just cannot do. The reason AJAX is so popular is
that it only requires functionality built into the browser (namely DHTML and
AJAX capabilities). The user does not need to download and/or configure
plugins. It is easy to incrementally update functionality and know that that
functionality will readily available, and there are not any complicated
deployment issues. That said, AJAX-based functionality does need to take
browser differences into consideration. This is why we recommend using a
JavaScript library such as Dojo which abstracts browser differences. So the
"bottom line" is: If you are creating advanced UIs where you need more advanced
features on the client where you want UI accuracy down to the pixel, to do
complex computations on the client, use specialized networking techniques, and
where you know that the applet plugin is available for your target audience,
applets are the way to go. AJAX/DHTML works well for applications where you
know the users are using the latest generation of browsers, where DHTML/AJAX
"good enough" for you, and where your developers have JavaScript/DHTML/AJAX
skills. Many amazing things can be done with AJAX/DHTML but there are
limitations. AJAX and applets can be used together in the same UIs with AJAX
providing the basic structure and applets providing more advanced
functionality. The Java can communicate to JavaScript using the Live-Connect
APIs. The question should not be should framed as do I use AJAX or applets, but
rather which technology makes the best sense for what you are doing. AJAX and
applets do not have to be mutually exclusive.
|
3.16 What kinds of applications is Ajax best suited for?
|
|
We don’t know yet. Because this is a relatively new approach, our understanding
of where Ajax can best be applied is still in its infancy. Sometimes the
traditional web application model is the most appropriate solution to a
problem.
|
3.17 Does this mean Adaptive Path is anti-Flash?
|
|
Not at all. Macromedia is an Adaptive Path client, and we’ve long been
supporters of Flash technology. As Ajax matures, we expect that sometimes Ajax
will be the better solution to a particular problem, and sometimes Flash will
be the better solution. We’re also interested in exploring ways the
technologies can be mixed (as in the case of Flickr, which uses both).
|
3.18 Where can I find examples of AJAX?
|
|
While components of AJAX have been around for some time (for instance, 1999 for
XMLHttpRequest), it really didn't become that popular until Google took...
|
3.19 What is the XMLHttpRequest object?
|
|
It offers a non-blocking way for JavaScript to communicate back to the web
server to update only part of the web page.
|
3.20 How do I access data from other domains to create a mashup with Java?
|
|
From your JavaScript clients you can access data in other domains if the return
data is provide in JSON format. In essence you can create a JavaScript client
that runs operates using data from a different server. This technique is know
as JSON with Padding or JSONP. There are questions as to whether this method is
secure as you are retrieving data from outside your domain and allowing it to
be excuted in the context of your domain. Not all data from third parties is
accessible as JSON and in some cases you may want an extra level of protection.
With Java you can provide a proxy to third party services using a web component
such as a servlet. This proxy can manage the communication with a third party
service and provide the data to your clients in a format of your choosing. You
can also cache data at your proxy and reduce trips to service. For more on
using a Java proxy to create mashups see The XmlHttpProxy Client for Java.
|
|