Access-Control-Allow-Origin not working for iframe withing the same domain
问题 I'm trying to access an iframe within a subdomain and get a cross domain error. Here is the code of example .mydomain.com/iframe_test.html: <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> </head> <body> <iframe src="http://example2.mydomain.com/welcome.php" width="1000" height="600"></iframe> <script> $(document).ready(function() { setTimeout(function(){ $('#innerdiv',$('iframe').contents()).hide(); },5000); }); </script> </body> </html> And