最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Use ChromeFirefox while debugging client-side - Stack Overflow

programmeradmin0浏览0评论

I am using camera with getUserMedia and I get a few errors I want to fix. The thing is Visual Studio only allows me to debug JavaScript (I mean hitting breakpoints) with IE, and IE does not support getUserMedia.

I am using camera with getUserMedia and I get a few errors I want to fix. The thing is Visual Studio only allows me to debug JavaScript (I mean hitting breakpoints) with IE, and IE does not support getUserMedia.

Share Improve this question edited Dec 9, 2014 at 13:02 pwdst 13.8k4 gold badges37 silver badges51 bronze badges asked Dec 9, 2014 at 10:26 Arthur ReyArthur Rey 3,0443 gold badges24 silver badges49 bronze badges 5
  • Set a debugger; on those places where you want Chrome/Firefox to stop. – Andrei V Commented Dec 9, 2014 at 10:35
  • I tried this, but I can't hit any breakpoint to check its value. – Arthur Rey Commented Dec 9, 2014 at 10:44
  • 1 You need to open the Development Console and inspect it in the browser, not in Visual Studio – Andrei V Commented Dec 9, 2014 at 10:57
  • Is it really the only way? – Arthur Rey Commented Dec 9, 2014 at 10:59
  • I, personally, can't think of another. – Andrei V Commented Dec 9, 2014 at 11:09
Add a ment  | 

1 Answer 1

Reset to default 7

If you want to debug in a browser other than Internet Explorer then you will need to use the Developer Tools of that individual browser and set your breakpoints accordingly. Alternatively you could use console.log() and/or console.warn() to get the state of your objects in code. Visual Studio does not and cannot understand the implementations of different JavaScript and rendering engines (V8, Blink, Gecko etc.) - nor should it ever attempt to do so. These engines move so rapidly with six week release cycles the IDE would be a totally misleading proxy for the actual the platform you're supposed to be testing against.

Both Firefox and Chrome allow you to retain console contents beyond a page reload/navigation and there are tools like Browser Link in Visual Studio will allow you to test in multiple browsers simultaneously - inspecting the console results afterwards for errors (interactions will have to be tested individually in each browser).

If you are testing mobile devices Adobe Shadow that would potentially allow you to test on multiple tablets and/or phone simultaneously whilst using Dev Tools (I believe Chrome) on your laptop or desktop. Otherwise desktop browsers dev tools allow you to debug page running on a connected mobile device using the same browser, or - in the case of Firefox - also Chrome instances on the device.

It is well worth getting to know browser dev tools for front end debugging and troubleshooting, as these are much more powerful for this purpose than those provided with Visual Studio. The free CodeSchool course Discover DevTools (focussed on the Chrome DevTools and sponsored by Google/Chrome) may help you discover some of the features of client developer tooling, and many of the interfaces and techniques will be broadly applicable to other browser dev tools.

If you want to test on devices that are not available to you, browsers that you cannot install on your system (e.g. Safari on Windows) or simply a newer or legacy version which you cannot install alongside the one already installed locally then there are services like Browserstack which allow you to do so in hosted virtual machines. There is a Visual Studio extension available for BrowserStack to help connect to projects running locally.

发布评论

评论列表(0)

  1. 暂无评论