0

When the screen is full screen mode. User may go the normal mode with pressing F11 or Click on the pop up box to go normal mode. How do i detect user click on the pop up box only not any kind of keypress "Exit full screen (F11)" with javascriptenter image description here

Remember I need click event listener not keypress event listener

Supun Wijerathne
  • 11,964
  • 10
  • 61
  • 87
Ahmad Sharif
  • 4,141
  • 5
  • 37
  • 49

3 Answers3

0

Popup box might be a div or some html element which might be having an id. So, consider registering an click event listener based on id. Whenever user clicks on that element, the registered function gets fired. Refer below sample script. In the below script "abc" is the id of a div and I have registered a click event called "myFunction", whenever user clicks on the div then myFunction will be called.

document.getElementById("abc").addEventListener("click", myFunction);

function myFunction() {
//Do Something
}
Abhinay
  • 338
  • 1
  • 7
  • 22
  • How do i get this id. This popup is not the part of html code. Its part of browser. – Ahmad Sharif Nov 19 '15 at 10:26
  • Ok you need to detect click event listener for the exit full screen popup of google home page? Looks like you edited your question, your earlier question was not that clear. – Abhinay Nov 19 '15 at 10:28
0

Listening for a size change or the fullscreened element might give you a clue on the user exitting the fullscreen mode.

If you require the click event specifically, because you need to have it in the stack for things like opening a new window or other things that require user interaction, you are out of luck, though.

Tomáš Hübelbauer
  • 9,179
  • 14
  • 63
  • 125
0

This is quit impossible. Browser stop all event listener from this popup. So that javascript could not listen any event from the popup.

Whatever I have fix my problem in other way. As my goal is to detect weather the screen is full or not. This may help to others

$(window).resize(function(){
  if (screenX !== 0 && screenY !== 0) {
     // Do your stuff here
  }

});
Ahmad Sharif
  • 4,141
  • 5
  • 37
  • 49