Let's catch all the questions about Ajax to help you get through the second channel and quickly learn about the beauty and sadness of Ajax.
After years of development, the Web is still in the point of view, page change browsing mode. After the advent of Ajax, rewrite the interactive mode of the Web page must be constantly reload, using asynchronous technology, the Web page only updates the local content, thus providing users with a smoother, real-time interactive mode.
Less "Reload" the action, Ajax presents a more cool than the traditional effect, but whether the full use of Ajax, enterprises in addition to watching the lively, but also want to know "doorway." Will Ajax slow down performance? What are the main learning thresholds? Search engine will not find the content of the Web page, but the impact of the site exposure? Will other Ria (Rich Internet application) technology replace it? More importantly, will it lead to the problem of capital Ann?
Let's catch all the questions about Ajax to help you get through the second channel and quickly learn about the beauty and sadness of Ajax.
Concept
Q1: What are the benefits of using AJAX technology besides cool effects?
A: The so-called "cool" should mean that you can drag and drop on the Web page widget, color gradient, components fade/fade in, design larger/smaller effect, or amazing in the Web Mail can provide a similar outlook interface.
In fact, the most direct and obvious benefit is to reduce the number of Web page reload.
According to statistics, every time a Web page is refreshed, 10% of consumers are "sober" in the process of waiting, discovering that there may not be a need to buy and canceling the transaction. When a Web page is no longer modified by a small amount of data, it is necessary to reload the entire page, reducing the time that the user waits and providing a smoother handling experience.
Whether it is cool effect, exquisite screen, or smooth flow, the image of the site, merchandise sales and user experience have added points to the effect.
Q2: The control of fluency on the site is a bonus, but from the perspective of the enterprise, the level of concern also includes the application of intranet, Web applications suitable to join AJAX technology?
A: After we know about the Ajax applications of push Wang, Urmap, Yahoo! and Network Mail2000, we find that web apps are really good for Ajax technology.
Focus on continuous, effectively improve productivity
Application operations often involve complex processes, but after the web, the process becomes a series of Web page submissions (submit) Actions, each update page will take a few seconds to wait, and can not press "previous page" back to the previous step.
In the age of web, the biggest concern of the enterprise is not wasting the seconds waiting to load the page, but the idle waiting, naturally opening another page, and the attention is directed to other, more interesting information, and composure, perhaps half an hour later.
Therefore, for the shopping site, the continuous attention is the guarantee of the order, for the enterprise, it is the promotion of productivity.
Continuing the control experience of desktop applications
The "previous" mode of operation cannot be used to strongly show the differences between the "application" and "browser" operating habits. When an application executes an environment that is moved to the Web, the user still expects to retain the operational experience of desktop applications, through Ajax asynchronous technology, that has the opportunity to eliminate the gap between the application and the browser.
Take Yahoo! Mail Box and Mail 2000 as an example, after Ajax, the user experience is very similar to the operation of Outlook. Network engine information from the user's feedback found that because of the change in control mode, so that intuitive and convenient forward a big step, so users satisfaction significantly improved.
Q3: Will it slow down Web server performance?
A: Probably because of the cool effects of Ajax and the fact that the first time you load an AJAX page is longer than the average HTML page, it's easy to assume that using AJAX will slow down server performance. In fact, just the opposite!
Ajax technology differs from traditional Web pages and Web servers in terms of communication. The traditional approach is for the user to send a request to the Web server, and even if only one field is changed, the Web server still needs to reorganize a full web page, respond (Response) to the client, and the browser must reload again.
By contrast, Ajax technology enables Web pages to have programmatic capabilities, when users modify data, trigger JavaScript programs, and the browser transmits user input to the Web server, and the Web server sends back data to the browser, and when JavaScript receives the data, The results are then presented on the Web page.
No commit action is triggered in the process, the Web server only has to return the content that needs to be modified, and the browser has no reload action. This is a three-win situation for server load, bandwidth usage, and user-side operational experience.
Based on Urmap's experience of using AJAX technology to deliver map information, the server's burden is reduced by more than 10 times times the number of users, and bandwidth usage has not increased too much.
Then take the network engine information Mail 4.5 Beta version of the Ajax technology as an example, the observation results found that the server needs to calculate the amount of data to reduce the bandwidth cost also decreased. Take a one-page list of letters as an example, the past 100 messages about the need to transfer 120KB of data volume, now reduced to 30KB. Click the "New Letter Check" feature, the amount of data delivered is roughly the past 1/5~1/4.
Q4:autocomplete This kind of Ajax mechanism, frequently to the server to data, should slow down the performance, whether there are methods to solve?
Answer: AutoComplete or content Automatic Update Ajax mechanism, is the user very much like the function. But when the numbers are large, it is possible to slow down server performance.
However, such problems can be solved by design, such as setting up a quick-access mechanism, prolonging the reaction time, querying every 3 English letters, or restricting the use of data, etc., which are possible solutions.
"This is a way to manage resources," Chao Junhong, a urmap technology leader who led the development. "He example: Urmap Download the map information, in fact, slightly more than the scope of the Web page display, users to drag or zoom the map, in fact, called the use of the local data, and did not send a request to the server." Therefore, as long as the user's behavior pattern to adjust the design, you can reduce the burden on the server.
Q5: So how does Ajax affect the performance of the client?
A: Compared to the traditional Web page, Ajax technology allows the client and server to transfer less data, but also to avoid the Web page reload opportunities, Ajax operating phase of the performance is indeed better.
However, when you first log into the Web site, the downloaded data in addition to the content of the page, but also contains enhanced interactive JavaScript program, you may find that the loading time is longer. In response to client performance, Yahoo! International information software engineer Shintingyu said: "As much as possible to shorten the JavaScript code, you can minimize the impact." 」
Q6: If the enterprise wants to import Ajax, is the talent good to look for?
A: Ajax, including JavaScript, DHTML, CSS, XMLHttpRequest, XML, or JSON, is a collection of technologies, and there must be a threshold for understanding these technologies.
Ajax is primarily an application of JavaScript, but Shintingyu from interviewing JavaScript engineers: "Taiwan attaches more importance to ASP, Java, and PHP." "In the past, JavaScript was a script language for supporting Web pages such as warning messages or text-checking, so developers generally think that JavaScript, HTML, and CSS are just auxiliary languages for web design, so good javascript talent is hard to find."
"Technology is not a problem, JavaScript is not difficult, but it is not easy to write well," Zhang Jiaji, a web-tech research and development manager. Developers must develop JavaScript with a "core" mentality. 」
Q7: So for programmers who know JavaScript, where is the threshold for Ajax?
From a developer's standpoint, Chu Jihong, the founder of Twitter, thinks: "css and Dom are the main thresholds. 」
Ajax technology is beyond the scope of simple programming, developers need to work with designers, and understand Web pages related to CSS, DHTML, Dom and other technologies. Even though the mature tools are less difficult to learn, the more you need to learn, the more you will become a barrier.
Q8: So, does the Web development team's role positioning and cooperation approach, because the introduction of Ajax and must change?
A: The way of working is really going to be impacted. Take Yahoo! As an example, in the past, web design was divided into VD (visual Designer, visual designer) and RD (Research Developer, researcher) two roles. VD is responsible for web design, must understand the HTML application, RD is familiar with the technology of PHP, API, database and so on, let the Web page to concatenate back-end program and data.
Now between VD and Rd, there is a WD (Web Developer, Web developers), all the "view source" visible content, including HTML, CSS, JavaScript is the scope of the WD is responsible for.
The working method will produce obvious changes, the VD depicts the page should have the appearance, the WD thinks the HTML label the semantics, uses the correct label to make the correct webpage structure, then matches the CSS to give the appearance style. In addition, the most important task is to use JavaScript to compose the front-end interactive behavior of the Web page.
The Web page design process to WD, is still not a real page, not yet connected to the backend real links and data. When the page is handed over to Rd, the RD person is responsible for the actual links and data.
This development process is not unique to Taiwan's Yahoo! design, in the United States Yahoo! , they call WD the front-end Engineer, while the sweet potato cane is called web Master; trend technology is called Prototyper.
The change of working form is the inevitable trend. The design of the current Web page, in addition to the art, also contains a programmatic mechanism, the role of people and the development process will change. Even in the case of limited manpower, one must be decorated in two corners (usually the work of Rd and WD), but the mode of cooperation between design (Designer) and development (Developer) is still different from that of the past.
Q9: Does the Web page contain CSS, HTML, and JavaScript programs that can be difficult to maintain?
A: According to Yahoo! 's definition, Web pages include the above three elements, HTML definition structure, CSS design style, and JavaScript control behavior. The introduction of AJAX will force the Web page to use CSS, so modular segmentation method, but to improve the maintenance of the Web page.
However, while it is not difficult to maintain AJAX Web pages, the functionality of debugging is still a bottleneck, even though JavaScript's development tools are maturing compared to other programming languages. The main reason is that there are still differences in the events triggered by various browsers for the user, unless the browser is standardized, it is still difficult for development tools to simulate the behavior of various browsers.
But there are some options. Just like IE browser has launched Internet Explorer Developer Toolbar, or can choose IE Inspector launched Axscripter, and Firefox provides Firefox Debugger. With the help of these plug-in kits, the difficulty of debugging has been gradually reduced.
Q10: An existing Web site or Web application, is it recommended to overwrite it with Ajax technology?
A: If an emerging Web site or Web application, especially a product Web application or Web site, uses AJAX technology, it's almost an option, and it's easy to lose competitiveness if you don't provide AJAX results.
However, for existing websites, "technology for technology" is irrational behavior. "Advances in technology will always help, but we have to consider whether there is value in investing," Chao Junhong said. Companies should think about what Ajax can do. 」
Chu Jihong suggested: "For specific problems, using AJAX to solve the technical bottlenecks." "Many functions are often far-reaching, and a slight change must be completely rewritten, and the risk of a full renovation is too high."
Ajax is a collection of many technologies. For beginners, the threshold of Ajax is not low. Even if only micro-changes, in the process of testing and on-line, there are still a lot of trivial work to face, so it is not necessarily wise to adopt the decision.
Will Q11:ajax technology have a cross-platform limit?
A: If you ask if Ajax can cross the operating system platform, the answer is yes.
Q12:ajax technology How to solve the problem of cross-browser?
A: The problem with Ajax across browsers is the behavioral differences between browsers, so developers need to test the compatibility of JavaScript programs in the execution of various browsers and write different versions of the program for the Difference section.
Or, the simplest way, is to apply Yui and other frameworks, through the platform to solve the compatibility problem.
Can the application of Q13:ajax development run smoothly on different devices such as computers, mobile phones and PDAs?
A: The answer is no. "The main reason is that mobile devices support different specifications, regardless of J2ME, Flash or Ajax," said Feng Yanwen, general manager of the Act. 」
Moreover, each handset's screen size is different, moreover the general webpage data volume fills the handset screen to appear to be lengthy. To be aesthetically pleasing, it is necessary to provide specialized content for the action device. For example, Twitter, a well-known foreign micro-blogging site, designs specially designed website m.twitter.com for mobile platforms.
Q14: I heard that using AJAX to develop Web content, search engine may not be found, it will not affect the visibility of the site?
A: Actually, it's a design problem. This relates to a proprietary noun called SEO (search Engine optimization, search engine optimization). About SEO concerns, the principle of the search engine for the robot is based on the link to find other Web pages, and then find content, so Web content must use a fixed URL (permalinks), search engine will find.
If the content is dynamically generated by JavaScript, then it will become an event-driven, i.e., the user "open" the page or "click on" the link to produce the content, then the search engine robot can not find the data. Driven
Chu Jihong said: "This is a kind of thinking of website design." If you want to increase the exposure, you will be able to be found by the search engine. "Push the King about AJAX technology is mostly used in visual, each information has a separate Web site, they absolutely do not destroy the principles of"content unique"."
Q15: What kind of application is not suitable for using AJAX?
A: The following scenarios do not recommend the use of AJAX technology:
The scale of the page needs to change is very high
Zhang Jiaji stressed: "Depends on the key point, is how much data to move to the browser." "ajax suitable for use in local, a small amount of data changes to reduce the opportunity to reload the page, the page needs to update the ratio is very high, it is better to reload it!
Sort
After the popularity of ASP and JSP, it is a common application to build dynamic query report on Web page by using DataGrid control. In addition to the simple query function, you can also choose any location to change the way the field is sorted. This kind of application is not suitable for using AJAX.
Especially in the case of the number of data pens, Zhang Jiaji stressed: "20 pen and 100 of data, the impact on the effectiveness of the Web page, is absolutely not just 5 times times the gap. "For browsers, change sequencing is the entire DOM (Document Object model, file object models) of the destruction and the system, this kind of application is to be good at data processing database more appropriate."
Need to change the page application
Ajax is the pursuit of the implementation of the data update, so the URL column does not change, and there is no "previous page", "next page" record. Therefore, there is a need for pages, in particular, users may press the "previous page" of the application, it is not suitable for using AJAX.
The reason why Web applications are suitable for AJAX technology is that applications do not have the concept of page-change. Therefore, when developing AJAX applications, designers should also be able to manipulate thinking, bypassing the possibility that users will want to press the "previous page".
Q16: If you pay attention to high interactivity, other RIA technologies, such as Microsoft's Silverlight and Adobe Flash, can provide a more immediate interactive effect, why do you choose AJAX? Will Ajax be just a bridging technology?
A: This question must be divided into the following two levels to answer:
High threshold for Silverlight or Flash
Programmers who are accustomed to thinking on the right side of the brain may not be able to have both flash or Silverlight designed with their left brain. When we asked the push Wang's development team this question, the related person and so on all bobbing expresses does not like the flash. Chen Guanjie in the past to try to use flash experience to say: "flash performance is poor, the stylized behavior must be written in ActionScript. 」
From the Silverlight case presented by Microsoft, the German women's shopping website Otto, France's French-style shopping site, their image, intuitive and smooth design is indeed a dazzling fan.
If there is no professional art talent site, they are more difficult to face Dreamweaver or expression Blend, to accept the timeline (Timeline) combined with the concept of dynamic effects of layers, developers need to cross the threshold higher.
Flash, Silverlight, and Ajax can be used
As far as the Microsoft development Platform is concerned, companies that need a more cool visual effect than Ajax can use expression Studio to design visual elements such as Web pages, images, and animations, while the logical part of the operation is still developing AJAX applications through Visual Studio Tools, so they don't conflict.
The application of Flash, the script language used is ActionScript, its syntax is very similar to JavaScript, but still can make developers feel rejected. Adobe has now proposed solutions to enhance the interaction between Flash and Ajax, Adobe launched Flex-ajax Bridge, so that JavaScript and ActionScript can communicate with each other, then Ajax and flash components can coexist.
Security
Q17: Do you use Ajax to expose your site to higher risks?
A: The so-called Ajax, the most narrow term refers to the asynchronous transmission of communication, that is, the use of XMLHttpRequest this browser object to deal with client-side data exchange process. As far as common parlance is concerned, Ajax further includes the use of JavaScript to manipulate CSS and Dom (file object model) to render a rich visual effect. So Ajax technology already exists, it's JavaScript, and Ajax is just an idea of application.
JavaScript itself is a client-side programming language that is executed on the Web site user's computer, unlike server-side scripting, and thus poses a very low risk to the site itself.
Some people think that Ajax programs can see the way its program logic and variable usage through the view of code, and increase the attack surface of the website, unlike the server-side program, can hide the program syntax.
In fact, a safe site, the original must be in front of the data transmission to the back end, do a good job of filtering and gatekeeper, do not believe that the front of things, this is a website developers must bear in mind the golden rule. If the server-side program is designed to keep this in mind and to attach importance to the safety code of the program, it is just as secure whether the front-end is entered by the user or passed by a JavaScript program.
Instead, Ajax solutions developed by the server side, such as DWR, allow users to use back-end Java syntax from a front-end program, which can potentially pose a security threat.
Q18: Is there no potential risk when using XMLHTTP request for asynchronous transmission?
A: In fact, the browser at the beginning of the design of this object, has considered the issue of security, thus restricting the XMLHttpRequest requested resources and call script, both must be in the same domain, can not access the resources outside the network, to reduce the risk. This prevents malicious programs from grabbing data arbitrarily or uploading dangerous programs to other servers.
However, the Web 2.0 popular mashup (mashups), through the open API for data exchange, which is indeed bypassing the same domain restrictions, there is a certain risk. When designing this type of API, you must pay special attention to its access restrictions so as not to allow the hacker to take advantage of it.
Q19:ajax will frequently request information to the server, and will it create a blocking attack on the site (denial of Service) effect?
A: In terms of Ajax design patterns, it is true that the number of requests to the server will increase, often a little bit of a move, it will interact with the Web server or database, especially the more interactive effect.
Google search will take the function of automatic completion, list the possible search keywords, or yahoo-mo dictionary Query Services, there are similar design, as long as the input text, will ask the server to select the word.
This security issue should be viewed on two levels. The first application of this type of Ajax syntax, the original need to do a good job of performance considerations and testing, such as the use of fast access, record query high keyword, but can reduce the burden on the server.
Second, if the hacker is going to use DOS to launch an attack on a Web site, it is not necessarily an efficient way to use Ajax to launch DOS, either in the same way as Ajax.
Q20: If Ajax has a limited impact on the server side, what about the client side?
A: Although the use of Ajax for asynchronous transmission is limited by the local side, providing a certain degree of security, however, because of the use of JavaScript, will allow users to cross-site scripting attacks (Cross-site SCRIPTING,XSS) the opportunity to increase, The hacker can steal the user's account information or implant the malicious program into the user's computer.
In the past, users have been able to turn off JavaScript to reduce the risk of browsing the site, shutting down JavaScript from the AJAX Web site, and refusing to enter the site with the user, because basic functionality is not available.
From this point of view, it is true that Ajax prevails, let hackers have the opportunity to abuse users through XSS, but the success of XSS is usually the site itself already exists in the security line loopholes, such as not to check the user upload information, or the application, the system itself has loopholes, if you can do these security protection , the user is as secure as any other Ajax feature.