Skip to content Skip to sidebar Skip to footer

How Can I Find The Title Of Parent Window In Javascript?

How can I find the title of parent window in javascript? I use alert(window.parent.document.FormName); and alert(window.parent.document.title); and alert(window.parent.pare

Solution 1:

use this code for your solution

  1. pageMain.html

    <html><head><title>Parent Window</title></head><body><inputtype="text"id="data"value="23444" /><ahref="#"onclick="javascript:openChildWindow();">Open Child Popup window</a></body><script>functionopenChildWindow() {
        window.open('page1.html','childWindow','width=400,height=400');
    }
    </script></html>
  2. page1.html

    <html><head><title>Child Window</title></head><bodyonload="initializeMainDiv();"><divid="mainDiv"></div></body><script>functioninitializeMainDiv() {
       alert( window.opener.document.title )
      }
      </script></html>

Solution 2:

You are probably trying to access the title of the parent window from an iframe which is located on another server. For security reasons it is impossible.

Post a Comment for "How Can I Find The Title Of Parent Window In Javascript?"