0

Would like to detect when my webpage is running in Firefox Responsive Design Mode so I can make adjustments in a javascript script that I have written. Have researched javascript events, but did not find anything that would trigger a listener when ctrl-shift-m is invoked.

Appreciate your kind assistance with my inquiry.

  • Possible duplicate of [Detecting combination keypresses (Control, Alt, Shift)?](https://stackoverflow.com/questions/37557990/detecting-combination-keypresses-control-alt-shift) – A.J Alhorr Oct 29 '18 at 14:37
  • It's worth noting you can also open Responsive Design Mode using the button on the F12 tools without the key combination. – Matt Oct 29 '18 at 14:40
  • or load pages while Responsive Design Mode is already activated. – Thomas Scheffer Oct 29 '18 at 14:41
  • On the other hand, have a look at https://hammerjs.github.io/, this is gesture detection library, if you are interested in detecting if you are on mobile. – muradm Oct 29 '18 at 14:48
  • Could you maybe elaborate on what you're trying to achieve? What adjustments are you trying to perform? – chazsolo Oct 29 '18 at 14:51
  • further elaboration - my script calculates width of viewport (getcomputedstyle.propertyvalue(width)) to which I add scrollbar width (window.innerwWidth - document.documentElement.clientWidth) and default body margin-left (8px) and margin-right (8px). everything adds up correctly in regular firefox. however, when after entering Firefox Responsive Design Mode, my total is 17px too large. so i thought that if I could just detect when RDM mode is invoked, I could then make relevant adjustments. best regards. – Dean Atteberry Oct 29 '18 at 15:05
  • reading responses suggested further avenues for researching with result of locating the answer - this post (Get browser window width including scrollbar) talked about using window.innerwidth, updated my script with that coding and gives consistent results now in both regular firefox and firefox RDM. thank you, stack overflow, for making this resource available so we can get these puzzling technical questions resolved! – Dean Atteberry Oct 29 '18 at 15:13

0 Answers0