Analysis of advantages and disadvantages of single page application

Advantages and Disadvantages of Single-Page Web Application
1. Definition
Single-page Web application (single-page application referred to as SPA) is a special kind of Web application. It confines all activities to a Web page and loads the corresponding HTML, JavaScript and CSS only when the Web page is initialized. Once the page is loaded, the SPA will not reload or jump to the page due to user actions. Instead, it uses JavaScript to dynamically transform the content of HTML, so as to realize the interaction between UI and users. SPAs can provide a smoother user experience by avoiding page reloads.

2. Advantages and disadvantages The emergence of

single- page Web programs is an inevitable result of the development of rich clients, but this technology has some limitations, so it is necessary to understand its advantages and disadvantages before using it.

1. Advantages:

1). Good interactive experience The

user does not need to refresh the page again, and the data obtained is also obtained asynchronously through Ajax, and the page is displayed smoothly.

2). Good separation of front-end and back-end work mode

Single- page web applications can be used with RESTful protocols, provide interface data through REST API, and use Ajax to obtain asynchronously, which helps to separate client-side and server-side work. Further, it can be decomposed into two parts: static page and page interaction on the client side.

3) Reduce the pressure on the server The

server can only use the data, regardless of the display logic and page synthesis, the throughput will be improved several times;

4) Share a set of back-end program codes, which can be used at the same time
without modifying the back-end program codes Web interface, mobile phone, tablet and other clients;
2. Disadvantages:

1). SEO is difficult

Since all the content is dynamically replaced and displayed in one page, it has a natural weakness in SEO, so if your site attaches great importance to SEO and uses a single-page application, then make some static pages for search engines to use Bar.

2). Forward and Backward Management

Since a single-page web application displays all content on one page, the browser's forward and backward functions cannot be used. All page switching needs to establish stack management by itself. Of course, there are solutions to this problem, such as using Hash + iframe implementation in URI.

3). The initial loading takes a lot

of time. In order to realize the function and display effect of a single-page Web application, it is necessary to load JavaScript and CSS uniformly when loading the page, and some pages can be loaded when needed. Therefore, the JavaScript and CSS codes must be combined and compressed. If a third-party library is used, it is recommended to use the CDN of some large companies, so the consumption of bandwidth is inevitable.

3. Framework AngularJS
AngularJS is an MV* framework, which is most suitable for developing client-side single-page applications. It is not a functional library, but a framework for developing dynamic web pages. It focuses on extending the functionality of HTML, provides dynamic data binding, and works well with other frameworks such as jQuery.

If you're developing a single page application, AngularJS is the way to go. Apps like Gmail, Google Docs, Twitter, and Facebook all use AngularJS to its strengths. But applications that do a lot of manipulation of the DOM, such as game development, or simply need extreme speed, are not the place for AngularJS.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326944433&siteId=291194637