title: Cross site scripting attacks and same origin policy
body: <p>I am familiar with the persistent and non-persistent <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">XSS</a>.
  I also know about <a href="http://en.wikipedia.org/wiki/Same_origin_policy">Same origin policy</a> that prevents/restricts requests originating from one websites page to go to another websites servers. This made me think that the same origin policy can stop at least the non-persistent type of XSS attacks (Because in the persistent type of attack the malicious code origin would be same as the private information that is stolen). 
  Is my understanding correct? Can SOP be used to stop/reduce these attacks?</p>
  
  <p>EDIT: Okay I was confusing between invoking methods between 2 scripts at the browser side and invoking methods such as HTTP POST on another website. Thank you for the answer jakber.</p>
  
  <p>Now I have another question, wouldn't SOP be able to prevent <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery">Cross-site request forgery</a>?
  The example given in the wikipedia talks about Bob accessing a malicious image tag created by Mallory on the chat forum. However, as per the SOP rule, the malicious script should not be able to access bank's cookie. Am I missing something here?</p>