Skip to content

Any way of preventing zoom (in and out) in browser during experiment? #845

Answered by jodeleeuw
yuvalharr asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @yuvalharr,

Not that I know of. I suspect it is not possible because that would get in the way of accessibility, which browsers are interested in maintaining.

You can detect zoom events though:

var zoom_event = [];

window.onresize = function(){
  console.log(window.devicePixelRatio);
  zoom_event.push({timestamp: performance.now(), zoom_ratio: window.devicePixelRatio});
}

// add this trial to your timeline near the end of the experiment
// this will store the zoom_event data in the data for this trial.
var record_zoom_events = {
  type: 'call-function',
  func: function(){
    return JSON.stringify(zoom_event);
  }
}

I'd suggest:

  1. Asking participants to not use the zoom feature at th…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by jodeleeuw
Comment options

You must be logged in to vote
2 replies
@jodeleeuw
Comment options

@becky-gilbert
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants