119

I don't want to do anything special or tricky with respect to Windows 8 and pinning, I just don't want to see the 404 Not Found messages as IE looks for browserconfig.xml scrolling by in my log files.

Is there a trivial browserconfig.xml file that I can put in my root that will satisfy IE and act as a good place holder should I decide to later add better support for Window 8?

drchuck
  • 4,415
  • 3
  • 27
  • 30

6 Answers6

90

I added the meta code to my head, but I'm still getting browserconfig.xml requests too.

So I think best way is; according to them: https://learn.microsoft.com/browserconfig.xml

<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
    <msapplication>
    </msapplication>
</browserconfig>
musa
  • 1,457
  • 18
  • 37
61

There is a sample on Microsoft's MSDN page Browser configuration schema reference.

You put the browserconfig.xml file in the root folder of the web server.

You can also include:

<meta name="msapplication-config" content="none"/>

in your HTML to prevent IE from looking for this file, if that is an option for you that might work as well.

Graham Miln
  • 2,724
  • 3
  • 33
  • 33
John Bush
  • 731
  • 5
  • 4
  • 6
    Although I have the meta tag on my page I saw very seldom requests for browserconfig.xml from a user agents which identified as IE 11. So probably the really only way to get rid of those 404s is to also add an empty file for browserconfig.xml. I tried pinning using the empty file and didn't see a difference with or without the empty file. – Gerd K Aug 05 '14 at 17:00
  • 4
    That example is not "the simplest/minimal" – HorusKol Jul 23 '15 at 00:04
43

The easiest solution is actually to just use the official Microsoft Browserconfig.xml file builder: http://www.buildmypinnedsite.com

You can build a full xml file, and be given all the sized images of your logo in just 3 steps. I just did it for my site and it only took 2 mins.

It will generate a full browserconfig.xml file, and supply all the titled images in a single zip file.

Edit 1/8/2015: I just found another option: http://realfavicongenerator.net/

The benefit of this website it is generators your browserconfig.xml AND all your apple-touch-* icons, favicon etc. Basically a one stop website for generating everything once.

HNygard
  • 4,526
  • 6
  • 32
  • 40
Laurence
  • 58,936
  • 21
  • 171
  • 212
  • 3
    This a good solution but doesn't really answer the OP, as they just want a placeholder. – Rob Nov 05 '15 at 12:57
  • Top, Perfect - doing the job very fine and fully automatic, afterwards you can download a full package with all files in it. Great. – johngrinder Jan 17 '16 at 13:47
  • Unfortunately neither site creates a browserconfig.xml file. – Peter May 02 '18 at 13:20
32

Adding a meta tag might or might not work. We added this tag, but we still received 404 errors for browserconfig.xml requests all the time. At the end we decided to do a simple xml.

Our browserconfig.xml looks like this and basically it just tells where 4 images are located.

<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
    <msapplication>
        <tile>
        <square70x70logo src="/mstile-70x70.png"/>
        <square150x150logo src="/mstile-150x150.png"/>
        <wide310x150logo src="/mstile-310x150.png"/>
        <square310x310logo src="/mstile-310x310.png"/>
        <TileColor>#8bc53f</TileColor>
        <TileImage src="/mstile-150x150.png" />
        </tile>
    </msapplication>
</browserconfig>

And put this in your html:

<meta name="msapplication-config" content="/browserconfig.xml" />

And now is okay

Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167
Tine Koloini
  • 471
  • 5
  • 5
7

You could as well just add it to your HTML and set the config to "none" like this:

<meta name="msapplication-TileColor" content="#009900" />
<meta name="msapplication-square70x70logo" content="images/smalltile.png" />
<meta name="msapplication-square150x150logo" content="images/mediumtile.png" />
<meta name="msapplication-wide310x150logo" content="images/widetile.png" />
<meta name="msapplication-square310x310logo" content="images/largetile.png" />
<meta name="msapplication-config" content="none"/>

Sources:

http://samples.msdn.microsoft.com/iedevcenter/PinnedSites/scenario1.html https://msdn.microsoft.com/library/dn320426

William Desportes
  • 1,412
  • 1
  • 22
  • 31
totas
  • 10,288
  • 6
  • 35
  • 32
  • 6
    Adding all these meta tags is probably the worst solution, IMO. If you do that, you're sending all that data to **every** visitor of your site, on **every** page view. Two advantages with browserconfig.xml are: 1. the only ones who get anything are people running a browser that cares about it, and 2. the browser can cache the file and not download it again. – Chad Dec 27 '16 at 22:13
  • 1
    @Chad - see this is why you have to be careful being so absolute about statements like that, it forgets your use case is not all use cases - this is an optimal solution for anyone who would like to package a PWA as a single file, but still have it installable as a Win8 app/etc… – MJHd Feb 17 '22 at 19:44
6

There is a third way to prevent browserconfig.xml from filling your log files with 404 errors. You can return a null value (444) from the server and turn off logging for just that location. This is relevant because favicon.ico does the same thing ignoring the meta head tags and the browser calling it (also generating a 404). The problem is larger than just this one unwanted file.

To your specific question of preventing 404 errors in your logs on browser.xml - for NGINX, you can create a new file in /etc/nginx/snippets/ and then #include that file in your /etc/nginx/sites-available/example.org file inside of the server block.

Example: /etc/nginx/snippets/block-known-errors.conf has the following contents:

location ~* /(favicon.ico|browserconfig.xml)$
   { access_log off; log_not_found off; return 444; }

Then in your config at /etc/nginx/sites-available/example.org you would add:

include /etc/nginx/snippets/block-known-errors.conf;

Note in the location specification in NGINX is using a regular expression and is case insensitive. And because it is a location is must be inside of the server specification.

In practice, we actually nest our includes in the /etc/nginx/snippets/ folder and have one global include and other includes for specific sites depending on security/technology requirements. This allows our endpoints to fix a global issue almost immediately by adding one file or editing an existing file to manage our logs.

There is only so much cruft you can see through with OSSEC and an ELK stack.

I am sure mod_rewrite in Apache could do this as well.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
eschipul
  • 61
  • 1
  • 2