title: How to use javascript to get information from the content of another page (same domain)?
body: <p>Let's say I have a web page (<code>/index.html</code>) that contains the following</p>
  
  <pre><code>&lt;li&gt;
      &lt;div&gt;item1&lt;/div&gt;
      &lt;a href="/details/item1.html"&gt;details&lt;/a&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>and I would like to have some javascript on <code>/index.html</code> to load that
  <code>/details/item1.html</code> page and extract some information from that page.
  The page <code>/details/item1.html</code> might contain things like</p>
  
  <pre><code>&lt;div id="some_id"&gt;
      &lt;a href="/images/item1_picture.png"&gt;picture&lt;/a&gt;
      &lt;a href="/images/item1_map.png"&gt;map&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My task is to write a greasemonkey script, so changing anything serverside is not an option.</p>
  
  <p>To summarize, javascript is running on <code>/index.html</code> and I would
  like to have the javascript code to add some information on <code>/index.html</code>
  extracted from both <code>/index.html</code> and <code>/details/item1.html</code>.
  My question is how to fetch information from <code>/details/item1.html</code>.</p>
  
  <p>I currently have written code to extract the link (e.g. <code>/details/item1.html</code>)
  and pass this on to a method that should extract the wanted information (at first
  just .innerHTML from the some_id div is ok, I can process futher later).</p>
  
  <p>The following is my current attempt, but it does not work. Any suggestions?</p>
  
  <pre><code>function get_information(link)
  {
      var obj = document.createElement('object');
      obj.data = link;
      document.getElementsByTagName('body')[0].appendChild(obj)
      var some_id = document.getElementById('some_id');
      if (! some_id) {
          alert("some_id == NULL");
          return "";
      }
      return some_id.innerHTML;
  }
  </code></pre>