title: iframe Back with javascript - avoid main page go back
body: <p>I'm using an <code>iframe</code>, and I have a back button which runs this javascript code (when user clicks on back button):</p>
  
  <pre><code>document.getElementById("myframe").contentWindow.history.go(-1); // back
  </code></pre>
  
  <p>This works fine, but If there is no previous page in the frame, main page will go back.</p>
  
  <p>How to avoid this? I want just iframe to go back, and if there is no previous page, simply do nothing.</p>
  
  <p>EDIT: <a href="http://jsfiddle.net/Brpj6/" rel="nofollow">This</a> is my code. (@ jsfiddle)</p>