title: Unsafe JavaScript attept to access frame error in Chrome when replacing textNode
body: <p>I'm trying to replace each <code>textNode</code> of the DOM tree using the following function:</p>
  
  <pre><code>//Replace each word objective with reposition in each control of the actual jQuery object   
  jQuery.fn.replaceEachOne = function (objective, reposition) {
      var regExp = new RegExp('([\\s]'+objective+'[\\s])', "igm");
      this.contents().each(function(){
                  if (this.nodeType == 3) {//if is a Node.TEXT_NODE, IE don't have Node object
                      //console.log("pName: "+this.parentNode.nodeName+" pType: "+this.parentNode.nodeType+" Data: " + this.parentNode.data);
                      if(this.data.search(regExp) != -1){
                          var temp = document.createElement("span");
  
                          temp.innerHTML = this.data.replace(regExp, reposition);
  
                          //Insert the new one
                          this.parentNode.insertBefore(temp, this);
  
                          // Remove original text-node:
                          this.parentNode.removeChild(this);
                      }
                  }
                  else{
                      $(this).replaceEachOne(objective, reposition);
                  } 
              }); 
  }
  </code></pre>
  
  <p>It works but it throws 20 errors like this (Google Chrome, IE don't throws):</p>
  
  <blockquote>
    <p>Unsafe JavaScript attempt to access
    frame with URL
    <a href="http://cdn.apture.com/media/html/aptureLoadIframe.html?v=21872561" rel="nofollow">http://cdn.apture.com/media/html/aptureLoadIframe.html?v=21872561</a>
    from frame with URL
    <a href="http://c-jfmunoz:5000/SitePages/Home.aspx" rel="nofollow">http://c-jfmunoz:5000/SitePages/Home.aspx</a>.
    Domains, protocols and ports must
    match.</p>
  </blockquote>
  
  <p>Doing some debugging I look that it throws the exception when the textnode is being inserted into a web form.</p>
  
  <p>I have to attach this JavaScript to a Sharepoint 2010 site. When viewed locally Chrome doesn't throw the exception. </p>
  
  <p>How can I fix this?</p>