Same Origin Policy Purpose | User Data vs. Basic Page Data | Client Side Page Scrapes
<p>I wanted to scrape pages client-side not server-side.  However the same-origin policy prevents me from doing this.</p>

<p>What I'm trying to understand is why I don't have read only access to the DOM of another site.</p>

<p>What security risk does this pose to the site, if I can get the same information by pulling the page onto the server and accessing it any ways.</p>

<p>I simply want to pull basic information from a page like:</p>

<pre><code>document.title
</code></pre>

<p>If I can do this serve side, why not client side?  The main difference being the extra round-trip that I don't want to pay for?</p>

<p>Obviously user's data should not be accessible, and this is obvious and I don't need information on this.  But in the same way I can pull in a generic version of a page using</p>

<pre><code>file_get_contents
</code></pre>

<p>and parse the DOM, I would like to do client - side.</p>

<p>What is the technical limitation not allowing JavaScript to determine the difference between...giving access to user defined data vs. generic page data? </p>

<p>PHP can do it.</p>

<p>Why can't JavaScript?  </p>

<p>What it the limitation?</p>

<p>I don't want to necessarily circumvent it or hack it, but understand the purposed better and maybe find that it does not apply to the case I have...page scrapes client side</p>

<p><strong>Related</strong></p>

<p><a href="http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy">Ways to circumvent the same-origin policy</a></p>

<p><a href="http://stackoverflow.com/questions/5863744/same-origin-policy">Same origin policy</a></p>

<p><a href="http://stackoverflow.com/questions/10768768/how-are-bookmarklets-javascript-in-a-link-verfied-by-servers-how-is-security">How are bookmarklets( javascript in a link ) verfied by servers? How is security kept?</a></p>

<p><a href="http://en.wikipedia.org/wiki/Representational_state_transfer#Central_principle" rel="nofollow">http://en.wikipedia.org/wiki/Representational_state_transfer#Central_principle</a></p>
