Home > Web Front-end > JS Tutorial > body text

Summary of advantages and disadvantages of Ajax

php中世界最好的语言
Release: 2018-04-24 16:59:20
Original
1637 people have browsed it

This time I will bring you a summary of the advantages and disadvantages of Ajax. What are the precautions for using Ajax? The following is a practical case, let's take a look.

Advantages of ajax

Everyone basically has a deep understanding of the benefits that Ajax brings to us. Here I will just briefly talk about a few points:

1. The biggest point is that the page does not refresh and communicates with the server within the page, giving the user a very good experience.

2. Use asynchronous mode to communicate with the server, without interrupting the user's operation, and have a faster response capability.

3. Some of the work previously burdened by the server can be transferred to the client, using the idle capacity of the client to process it, reducing the burden on the server and bandwidth, and saving space and broadband rental costs. And to reduce the burden on the server, the principle of ajax is to "fetch data on demand", which can minimize the burden on the server caused by redundant requests and responses.

4. Based on standardized and widely supported technology, there is no need to download plug-ins or small programs.

Disadvantages of ajax

Now I will focus on the shortcomings of ajax, because usually we mostly pay attention to what ajax brings to us. The benefits include improved user experience. The shortcomings caused by ajax have been ignored.

The defects of ajax described below are all caused by its innateness.

1. Ajax kills the back button, which destroys the browser's back mechanism. The back button is an important feature of a standard web site, but it doesn't work well with JavaScript. This is a serious problem caused by ajax, because users often hope to cancel the previous operation by going back. So is there any solution to this problem? The answer is yes. Those who have used Gmail know that the ajax technology used under Gmail solves this problem. You can go back under Gmail. However, it does not change the ajax mechanism. It just uses a stupid but effective one. The way to do this is by creating or using a hidden IFRAME to reproduce the changes on the page when the user clicks the back button to access the history. (For example, when the user clicks back in Google Maps, it

searches in a hidden IFRAME and then reflects the search results onto an Ajax element to restore the application state to what it was at that time .) However, although this problem can be solved, the development cost it brings is very high, which is contrary to the rapid development required by the ajax framework. This is a very serious problem caused by ajax.

2.

Security Issues Technology also brings new security threats to IT companies. Ajax technology is like establishing a direct channel for corporate data. This allows developers to inadvertently expose more data and server logic than before. Ajax logic can be hidden from client-side security scanning technology, allowing hackers to create new attacks from remote servers. Ajax is also difficult to avoid some known security weaknesses, such as cross-site scripting attacks, SQL injection attacks and credentials-based security vulnerabilities.

3. The support for search

index engines is relatively weak.

4. Destroyed the exception mechanism of the program. At least from the current perspective, ajax frameworks such as ajax.dll and ajaxpro.dll will destroy the exception mechanism of the program. Regarding this problem, I have encountered it during the development process, but after checking, there is almost no relevant introduction on the Internet. Later, I did an experiment myself, using ajax and traditional form submission modes to

delete a piece of data... which brought great difficulties to our debugging.

5. In addition, there are some other problems, such as violating the original intention of URL and resource positioning. For example, if I give you a URL address, if Ajax technology is used, maybe what you see under the URL address is different from what I see under this URL address. This is contrary to the original intention of resource positioning.

6. Some handheld devices (such as mobile phones, PDAs, etc.) currently do not support ajax very well. For example, when we open a website using ajax technology on the mobile browser, it currently does not support it. , of course, this issue has nothing to do with us.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Detailed explanation of the use of Ajax() to interact with the background

Detailed explanation of methods for handling WebService cross-domain issues

The above is the detailed content of Summary of advantages and disadvantages of Ajax. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!