Debugger acting different then run
I have been using Webstorm developing this new system for several months now. And I have been impressed.
Today I ran into an issue using the debugger with Chrome that I knew worked fine. But is now getting different results each time a run it.
I am using a script to detect if a device is mobile or desktop.
function CheckDevice() {
var scrollDiv = document.createElement('div');
scrollDiv.style.cssText = 'width:100px;height:100px;overflow:scroll !important;position:absolute;top:-9999px';
document.body.appendChild(scrollDiv);
var result = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
blnMobileDevice = result === 0;
}
The object is: if result = 0, it’s mobile.
I have chrome open and run it w/o debugger, works perfect. Detects the correct configuration of Chrome.
If I run the debugger and have Chrome set to a mobile device, most times it come up not a mobile device. However, sometimes it comes up right. But once it detects it wrong, it stays wrong even if I use run instead of debugger. This has been working fine up until today.
If I change the mobile device in Chrome, and hit run, it works correctly. And if I use the debugger it may or may not work right.
As a note, once it is not operating correctly, result = 17, which would indicate a desktop.
If I have Chrome configured as a desk top, result = 17.
If I access the page via the URL within Chrome or any other browser, outside of Webstorm, it works correctly.
The only thing I changed in Webstorm was adding the SVG Plugin. It was not recognizing the SVG tag as a legitimate tag. I don’t see how that could have affected it.
I realize this could be an issue with Chrome. Is there a way to reset Chrome?
Please sign in to leave a comment.
I think this is a Chrome issue, but still not sure.
I set it to Nexus 10, 1280 x 800.
My viewport is correctly set up.
If I hit run, works great. If I debug, may work right the first time and then works fails, however, the screen is wrong. Chrome is showing 1280 x800. Using window.innerWidth, it shows 800. When it fails, it sees the screen as 480px width. My CSS media kicks in also.
When it’s off it’s off. If a click on something, as if a touch, something else reacts. It can’t even tell where the touch is occurring.
Is there something i just kick?
What I mean by shows 800. Chrome is showing 800px on the screen scale, but JavaScript/CSS see 480px
Can't understand what is going on from your description... Just a supposition: by default, Webstorm starts a new Chrome instance with a new profile on debugging, it doesn't attach to already opened Chrome instance. This is done to ensure that Chrome is started with
--remote-debugging-portoption necessary to attach the debugger.... So Chrome runs with different (default) settings.This is not the issue on running - as Webstorm just opens the URL in running Chrome instance