I have set document.domain in the pages of my web application with which I wanted other web applications with different IPs but the same domain can communicate (pass and receive values on client side). Then in order to have my own cross-frame and cross-windows scripts work fine, I had to add this document.domain="x.com"; to every other page of my application. Everything works fine except for the modal pages which are created by window.showModalDialog method. Although I have set the document.domain in my modals, these pages can not communicate with their caller window as they did before and will face "permission denied" error. Any clue why?