Hi, I'm on a verge of desperation... I've spent lots of time coding to find out I was in "Access violation" I've made a really nice calculator for a web game. The web game has a sort of a marketplace where you could buy things, but it's built in a very uncomfortable way. On my site, I've added a calculator for this marketplace which would make it a lot more comfortable. The game is opened in a frame, and at the end of the calculation the user would be able to simply move all the results into the appropriate fields in the game frame. I used: parent.FrameName.forms.InputName.value = document.MyForm.InputName.value <i is a calculated value, since the game has no names to the forms..> Since while developing I used a page with copied source, All worked well, but when I ran the code online, I found out that I get "Access Denied" error when attempting to write into the external document Since the game checks for referrer, I have no idea what to do... Please help me around this thing
No, I'm trying to make JS fill up a form that is on a page on a different server. The page is loaded in a frame on my site... The problem is I found that there's this thing called "Same-Origin Policy" JS sticks to, and I need a workaround for it... If you know a way, I'd be most grateful!
Look one reply above.. I found the name to my problem: it's called "Same-Origin Policy". It means that no access will be granted to a document which is stored on a server that is not the server the JS code is located on, And/Or a document that has been loaded using a different protocol then the one the JS code is located on. An example: My site is: www.anExampleHost.com/dir/page.htm On page.htm there are 2 frames: frame1: code.htm frame2: http://www.aDifferentServer.com/path/page.html code.htm can't access page.html since it's summoned from a different host. Example2: My site is: http://www.anExampleHost.com/dir/page.htm On page.htm there are 2 frames: frame1: code.htm frame2: https://anExampleHost.com/dir/target.html code.htm can't access target.html since it's loaded via different protocol: http != https (secure http) My problem is of the first example. My question is: "Is there a way around it? Can I somehow bypass the Same-Origin Policy" ?
Using only javascript: no you can't, because it's cross site scripting. The workaround I think could be to extend your javascript with serverside coding. Something like sending a string+session_id+some unique key by firing off a regular post/get to the other site and on the receiving end the data sent would have to be processed and displayed making a call back to your end to trigger a refresh of the displayed data. I.E it would be necessary to establish this "communication pipe" on both ends. Just my $0.02