I'm encountering a strange bug that I'm having a hard time describing...
I'm working on an HTML5 Canvas application when it started behaving oddly when served from my localhost
server. I discovered that window.innerWidth
and window.innerHeight
were suddenly being reported incorrectly in both Firefox and Chrome. innerWidth should be 1366 on this machine but is being reported at 1525 in Firefox and 2048 in Chrome.
I thought it might be a strange glitch in my javascript, but I found that this is now affecting all pages viewed from localhost
and is messing with the css in some older applications.
The strange part is that everything works as expected when viewed from 127.0.0.1
. We've also found that this same problem happens when my boss views the app when served from a public Dropbox folder and viewed on his computer in Firefox (Chrome works fine). Served locally on that computer shows no issues however.
This one has me completely stumped. I'm hoping someone has an idea of a possible cause or a way to track down the issue since we can't allow this to happen to customers using the app.
Edit: some more numbers
window.innerWidth: 2048
window.outerWidth: 1366
screen.width: 1366
window.screen.availWidth: 1366
innerWidth is the only one that's wrong, and it's unrelated to the page content as these values remain the same even when opening blank files.