Make a web icon for your own web page

When I was doing an exercise to build a simple server with Node.js yesterday, I encountered a problem, that is, when the front-end web page requests data from the back-end, except for the basic requests made by our users, the browser will generally default to The built-in sends another request to the server, which is the well-known "/favicon.ico" request, which generally looks like this: we all know
Altthat this request is a web icon request sent by the browser to the server itself, the so-called web icon , just like these things:
Altand the webpages we write generally do not have this webpage icon, so the request often fails. This request failure will not affect the loading of the webpage, but every time we visit the webpage, the backend Node.js An "error!" will be prompted on the command line, and sometimes it will affect the operation of the back-end code in some special cases, so we usually have several methods to prevent this from happening, such as method 1:
In the main body of the server running code Add an if conditional statement, like this:
Altyou can prevent the backend from accepting icon requests;
Method 2 : Introduce an empty icon address in the front-end web page code, like this:
Altthe code is attached here: <link rel="icon" href="data:;base64,=">, of course, there are still many others method to block...
I originally planned to block the "/favicon.ico" request, but I somehow came up with an idea, why not create a web icon for myself? Although it seems to be very useful for learning to write The code is not very helpful, but it’s pretty cool to pretend to be a little tricky once in a while. Besides, in case this kind of little thing that is usually useless can come in handy one day, as the saying goes, walking in the rivers and lakes, many skills are not enough. Well, the following is the production process for everyone, it is quite simple, the kind you can read once:

Required software: PS

I think everyone will have this, come on, let's start:
1). First, open our PS, click "File" in the upper left corner, and then click "New";
Alt2). Then we set the canvas;
AltDefine the name by yourself, I set the length and width to be 100×100px, and the background can also be selected, I set it to be white, click OK after configuration; 3). The next step is
your free display time, enjoy yourself on this canvas Release your artistic talent;
4). After the artistic creation is finished, just save it, continue to click "File" in the upper left corner, and then click "Save as";
Alt5). Select the storage address and configure the file name and file format, other do not need to be modified, click Save;
Alt6). The default is the first one, just click "OK";
Alt
7). If you did not save the picture to your own project folder when saving, this step is You need to move the created icon file to your own project folder, otherwise the browser may not be able to get it;
8). The last step is to import the icon file, and import the icon file you made in the html code:
Altfill in the path here The path where the icon file is placed in the previous step is enough;
OK, it’s over here, and your exclusive web icon is released like this, is it quite simple
Alt?

Guess you like

Origin blog.csdn.net/weixin_46166330/article/details/104456143