title: Javascript: How to prevent triggering focus on input when window is focused?
body: <p>I have a classic case of an input that is cleared when gaining focus.</p>
  
  <p>The problem is that when user goes to copy some data from a spreadsheet e.g. and comes back to add this data to the input, the focus event of the input is triggered and whatever they typed is cleared.</p>
  
  <p><strong>How to prevent onfocus from being triggered when it is due to a browser window focus</strong> and not from a click on the input, a tab, the click of a label, or any traditional action in the page?</p>
  
  <p>NO JQUERY PLEASE.</p>
  
  <p>EDIT:
  OK apparently some people like to vote negatively every time a post does not have some code. So if you need a code to grasp this simple idea, here it is:</p>
  
  <pre><code>&lt;input type=text onfocus="this.value=''"&gt;
  </code></pre>