window.opener only works on server, but not on local machine

By | November 9, 2014
Share the joy
  •  
  •  
  •  
  •  
  •  
  •  

Today, I tried ckeditor function. But the window.opener.CKEDITOR.tools.callFunction always doesn’t work. I found out it works in IE, but not in chrome. It’s weird. After hours research, I put it in tomcat server, and started tomcat server, it works. So the conclustion is that window.operner only works in server, but not in local machine.

editor.html:

  1. <html>
  2. <head>
  3. <script src=”./ckeditor/ckeditor.js”></script>
  4. <script type=”text/javascript”>
  5. </script>
  6. </head>
  7. <body>
  8. <form method=”post”>
  9.     <textarea name=”content”>aaa</textarea>
  10. </form>
  11. <script language=”javascript” type=”text/javascript”>
  12.     CKEDITOR.replace( ‘content’, {
  13.         filebrowserBrowseUrl: ‘browser.html/browse.php’,
  14.         filebrowserUploadUrl: ‘browser.html/upload.php’,
  15.         filebrowserImageBrowseUrl: ‘browser.html?type=Images’,
  16.         filebrowserImageUploadUrl: ‘browser.html/upload.php?type=Images’
  17.     });
  18.     CKEDITOR.config.width = 850;
  19.     CKEDITOR.config.height = 300;
  20. </script>
  21. <input type=”button” onClick=”CKEDITOR.tools.callFunction(1, ‘abc.html’)” value=”setUrl”>
  22. </body>
  23. </html>

browser.html:

  1. <html>
  2. <head>
  3. <script type=”text/javascript”>
  4. function sendback(){
  5.          window.opener.CKEDITOR.tools.callFunction(1, ‘abc.html’);
  6. }
  7. </script>
  8. </head>
  9. <body>
  10. <form method=”post”>
  11.     <textarea name=”content”>aaa</textarea>
  12. </form>
  13. <input type=”button” value=”send back” onClick=”sendback();”/>
  14. </body>
  15. </html>