Favicon NOT working on Edge

前端 未结 13 1685
傲寒
傲寒 2020-12-16 09:19

I have a problem with this favicon I generated for a local server php project. It works fine on most browsers (Google Chrome, Mozilla Firefox and Opera) but on Microsoft Edg

13条回答
  •  萌比男神i
    2020-12-16 09:32

    Adding Cache-Control:public, max-age=14400 to the http header worked for me. Checked it with IE, Edge, and Chrome on Windows 10 using an ESP8266-12E running Arduino as a web server on a local network. (Haven't tried any Apple or Android-specific support yet). FWIW - Here's part of the html from the root page of my server:

    
    
    
    Favicon Test
    
    
    
    
    
    
    
    ...
    
    
    

    and here's a ESP8266/Arduino code snippet for creating the http header in the response and sending the icon data previously stored as a file using SPIFFS.

    ...
    f = SPIFFS.open("/favicon.ico", "r");
    if (!f) {
      Serial.println("file open failed");
    } else {
      Serial.println("favicon.ico open succeeded...");
      client.println("HTTP/1.1 200 OK");
      client.print("Content-Length:");
      client.println(String(f.size()));
      client.println("Content-Type:image/x-icon");
      client.println("Cache-Control: public, max-age=14400");
      client.println();  // blank line indicates end of header
      while (f.available()) {  // send the binary for the icon
        byte b = f.read();
        client.write(b);
      }
    f.close();
    ...
    

提交回复
热议问题