with "The application uses its own web server, so the browser talks to localhost." you are not actually saying that your application itself contains a webserver, running inside a browser, serving a website running on localhost, are you?
In this case, the application is a native executable containing a web server. (It runs in the background, controlled by an icon in the desktop notification area, which can also be double-licked to open a browser to the application's URL).