html - Odd javascript XSS error -
i'm designing simple way communicate between iframes, , getting odd xss error, though both urls have save domain.
unsafe javascript attempt access frame url file:///home/bryre/shareddata/programs/javascript/pong/htdocs/connectionwindow.html frame url file:///home/bryre/shareddata/programs/javascript/pong/htdocs/connectiontest.html. domains, protocols , ports must match. do need have them on server work? here code:
connectiontest.html
<html> <head> <title>connectiontest</title> <script src='connection.js'></script> </head> <body> <script> var windowtoconnectto = document.createelement('iframe') windowtoconnectto.src = 'connectionwindow.html' document.body.appendchild(windowtoconnectto) var connection = new connection({}); connection.connect(windowtoconnectto, 10); </script> </body> connectionwindow.html
<html> <head> <title>connectiontest</title> <script src='connection.js'></script> </head> <body> <script> var connection = new connection({}); </script> </body> connection.js
function connection(commands){ this.indiv = document.createelement('div') this.indiv.id = 'in' this.indiv.style.disply = 'none' document.body.appendchild(this.indiv) this.commands = commands } connection.prototype = { attemptconnect: function(to){ to.document = (to.contentwindow || to.contentdocument) if(to.document.document) to.document = to.document.document this.to = to.document.getelementbyid('in') //error happens here if(this.to == null) return false return true }, connect: function(to, retryrate){ cthis = var interval = setinterval(function(){ if(cthis.attemptconnect(to)) clearinterval(interval) }, retryrate) } }
they don't have domain, local files. use http server access them.
Comments
Post a Comment