title: Why doesn't the value of info.frameUrl remain constant when clicking the same element of a page?
body: <h2>This question is based on a misconception, please see <a href="https://stackoverflow.com/questions/28377607/delivering-a-message-via-chrome-tabs-sendmessage-to-a-specific-frame-on-a-tab">this question</a> instead.</h2>
  
  <h1>Subject</h1>
  
  <p>I am trying to create some context menu options via a Google Chrome extension that allow you to modify the contents of editable fields on certain web pages. My extension works perfectly on StackOverflow, where the DOM is nice and simple, but <a href="http://www.youtube.com" rel="nofollow noreferrer">Youtube</a> has been giving me trouble for some time now. </p>
  
  <h1>Problem</h1>
  
  <p>Many of the editable fields on Youtube are hidden in Iframes, so if I try to access <code>document.activeElement</code>from the top frame, I get the Iframe itself. </p>
  
  <p>I am trying to get around this by injecting <a href="https://developer.chrome.com/extensions/runtime#event-onMessage" rel="nofollow noreferrer"><code>chrome.runtime.onMessage()</code></a> listeners into every page. </p>
  
  <p>Then, I can presumably compare the value returned by <code>info.frameURL</code> in the <a href="https://developer.chrome.com/extensions/contextMenus#event-onClicked" rel="nofollow noreferrer"><code>chrome.contextMenus.onClicked()</code></a> event listener in the event page, with <a href="https://developer.mozilla.org/en-US/docs/Web/API/Location" rel="nofollow noreferrer"><code>window.location.href</code></a> in the content scripts to see if the message is addressing the correct frame or not. (See <a href="https://stackoverflow.com/questions/28055887/is-there-a-flexible-way-to-modify-the-contents-of-an-editable-element/28198957#28198957">this question</a>)</p>
  
  <p>The problem is that the value returned by  <code>info.frameURL</code> does not seem to be consistent. </p>
  
  <p>For example, if you go to the home page and use the main search box as the test element, sometimes the value is simply, www.youtube.com...., but other times it is plus.google.com..... or apis.google.com..... or accounts.google.com... and I am not sure why this is. </p>
  
  <p>Can someone explain why the value returned by the info.frameUrl would not remain constant each time you click the same frame?</p>