Chrome Device Mode - google-chrome

Chrome now has a very helpful "device mode" that can be used to preview a web page as it might appear on a host of devices. Very useful. I was wondering... is there a way to enter/exit device mode via JS run from the page itself. For some of what I do it would be handy to let people preview screens on different devices without having to explain that they can do this via the button on Chrome Developer tools. Googling has not yielded any obvious ways to accomplish this - perhaps it is not possble?ch

Related

Responsive view on Firefox Developer Tools show wrong width

I was testing a website with the Developer Tool of Firefox and I was facing a weird bug. Then I checked the window width with a simple console log console.log($(window).width) and I saw that the reported width in developer tools wasn't the same that javascript was detecting.
I tried than with the Google DevTools and showed width was consistent with the console log width.
Is this a Firefox bug or am I doing something wrong? Actually on a real mobile device and on Google DevTools the website works as it should, but if I test the same page on Firefox I see a bug that actually doesn't exists (and for this reason I've lost some time).
This are a couple of screenshots to better explain what I mean:
Google Chrome
Firefox
Resizing the browser window doesn't effect the JavaScript $(window).width
The problem is in the documentation for developer tools IMHO.
They don't mention a thing about the Touch Simulation changing the behavior of the rendering.
AFAIK, the Touch Simulation activates some form of "logical pixels" mode, where lengths are translated using device DPI, or perhaps DPR.
Deactivate it and see for yourself.

How to display iPhone's status bar on Chrome dev tools

I am developing an app with Ionic (1 !) and using ionic serve to test it on Chrome. I'd like to display the iPhone's status bar (battery, time and connection) on Chrome dev tools device mode.
Any knows if Chrome can do this?
I don't think there is a way inside of chrome dev tools. I've tried to find a good solution for a while, it is in their own words only 'for a first approximation'.
You can though, create the device with your specifications, HERE's a more complete list of available devices, where you can also shorten the length to get the size without the space of the status bar (yeah, not useful for the latest gen).
To better QA on mobile devices, maybe try something like Blisk, BrowserStack, Slant...
Or if it's for a screenshot, try something free like responsinator.
gl

Which tool should I use for responsive web development: Chrome web developer tool or simply resize the window?

I have been trying to make a responsive website for mobile devices . I have found two ways to test responsive design:
By resizing the window
Using Google Chrome developer's tools
In both of them I get a different view. Which one gives me the right view, as I use font-size and padding in 'em'.
Resizing browser window is not Responsive. While developing Responsive applications the easiest, but yet not perfect, way is using Chrome's Developer tools. Even that may give you different results, because mobile device screens are using not just width/height but also dpi. So 320 iphone6s screen is not going to be perfect match for 320px resized browser or equivalent android device.
Go for chrome developer tools. It's a great way of checking responsiveness. It comes with dimensions of popular mobile and tablet devices. So you can check for a variety of device at once.
Simply resizing the browser is not a right way of checking responsiveness.
Recently I built a page that works fine with both the ways you mentioned. You can check it here.
Let me know if you need any help.
I would say Chrome Dev Tools is the best bet for a local snapshot.
However, if you have access to one or more mobile devices you may want to launch the site on Heroku or another production environment and view it from the actual device.
An iPhone 6 for example, I find Chrome does not take into account the address bar or bottom nav in safari so things can be slightly off from the Chrome Dev view of iPhone 6.

How to bring up mobile keyboard in chrome dev tools?

I'm trying to test which keyboard type comes up by default for certain inputs on iOS and Android. Is there a way to bring up the on screen keyboard in Chrome devtools phone simulator?
So far I have tested the iOS version of my website by running the xcode simulator and pointing to my website but it would be really convenient to use devtools.
Update: 🙁 Virtual keyboard support is deprecated in Chrome 68+; this answer no longer works.
Original answer
You can view the standard keyboard for the Nexus 5X device for the portrait or landscape view:
However, you can't interact with it, nor does it change based on the context it is called from. I found by inspecting DevTools that it is simply an image file overlayed onto an SVG. There's nothing smart going on with these profiles. It's just useful to look at how the app responds to the reduced space.
To test the proper behaviour of keyboards with context, I would just recommend using XCode and Android emulators, or better still use real devices.
See: Test Responsive and Device-specific Viewports

a way to see my website as if on a ipad

I've got a little problem with my website and ipad/iphones. A certain tag in my css causes problems and I'm unable to check if I've solved the problem. Is there a way to look at my website as if on an ipad while not actually buying an ipad. Is there something like an ipad emulator or something?
You can use web (free) services that provide such functionality. There is a lot of them. For example: http://ipadpeek.com/ or http://mobiletest.me/.
There is also a simple solution that doesn't require any further app installation.
If you're running google Chrome you can enter the developer tools by hitting F12 on a PC and Command+option+I on a Mac.
In the developer tools you have on the top left corner of the screen a mobile device emulator, which you can choose various different models of mobile devices from. not just iPad and iPhone.
Note that you have to refresh the page each time you change a device emulator. Otherwise it won't load with all the characteristics of the current emulation.