Detecting if the browser window is moved with JavaScript?

This is for a demo... and i was just curious, can you detect if the window has been moved? Like if you move Firefox/Chrome/IE around your monitor? I doubt it, but i wanted to see since you can check for resize and focus/blurred windows.

Answers


I can only think of this (heavy) work-around, where you check if window.screenX and window.screenY have changed every x milliseconds

var oldX = window.screenX,
    oldY = window.screenY;

var interval = setInterval(function(){
  if(oldX != window.screenX || oldY != window.screenY){
    console.log('moved!');
  } else {
    console.log('not moved!');
  }

  oldX = window.screenX;
  oldY = window.screenY;
}, 500);

Though I would not recommend this -- it might be slow and I'm not sure if screenX and screenY are supported by all browsers


Need Your Help

How do I add a scalar value to a yt array?

python data-analysis yt-project

I'm trying to add a numerical floor to one of my derived fields in yt. However, when I try:

Querying a MySQL database step by step - Best method?

php sql mysql database ajax

I am building a web application that uses PHP 5, MySQL 5 and Javascript with jQuery and AJAX.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.