Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the four common mistakes made by rookies in the front end of web?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what are the four mistakes that often occur in web front-end rookies". The explanation in the article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the four mistakes that often occur in web front-end rookies?"

Error A transfer of the so-called "should work" code

Error: whether it's JavaScript or code running on the server, developers need to test and make sure it works, rather than thinking that it should work once it's deployed.

Impact: websites that do not undergo proper error checking are rogue to end users. Not only will it greatly affect the user experience, but the type of error message content may give hackers clues to infiltrate the site.

How to avoid: people make mistakes, and this philosophy applies to coding as well. With JavaScript, be sure to implement good techniques to prevent and catch errors. Although this article describes coding Windows applications in JavaScript, most of the content also applies to web development, and many tips are good! Another way to make your code reliable and survive future changes is unit testing.

If we are careful enough, we can catch the server-side code failure without being detected by the user. Only the necessary information is displayed, and be sure to set up friendly error pages, such as HTTP 404s.

Error 2 write bifurcation code

Error: with the noble idea of supporting all browsers and versions, developers are determined to create code that responds to any possible situation. There are piles of if statements in the code with bifurcations in all directions.

Impact: with the update of the new version of the browser, the code file will become more and more clumsy and difficult to manage.

How to avoid: implement functional detection and browser / version detection of the code. Functional detection technology can not only significantly reduce the amount of code, but also easier to read and manage. Consider using a library such as Modernizr, which not only helps with functional testing, but also automatically helps provide feedback support for older browsers that can't keep up with HTML5 and CSS3.

Error three non-responsive design

Error: assume that the developer / designer develops the website on a monitor of the same size.

Impact: when viewing a site on a mobile device or on a very large screen, the user experience is either difficult to see important aspects of the page, or even be careful not to navigate to other pages at all times.

How to avoid: a responsive way of thinking. Use responsive design in your website. Here are some practical tutorials on this, including responsive images, and a very popular library, Bootstrap.

Error 4 excessive website refresh

Error: the site you create needs to be fully refreshed for each interaction.

Impact: similar to bloated pages, the performance of page load time will be affected. The user experience lacks fluency, and each interaction can lead to a short (or long) reset of the page.

How to avoid: one way to quickly avoid this situation is to determine whether the content sent back to the server is really needed. For example, client script can be used to provide direct results when it is not dependent on server-side resources. You can also apply AJAX technology or further use the single-page application "SPA" method. Popular JavaScript libraries / frameworks, such as JQuery, KnockoutJS, and AngularJS, make it much easier to adopt these methods.

Thank you for your reading, these are the contents of "what are the four mistakes that often occur in web front-end rookies?" after the study of this article, I believe you have a deeper understanding of what the four mistakes that often occur in web front-end rookies are, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report