document.URL with popup

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #16
    Originally posted by katasterisma
    if I have two windows object (like my case) can I get information from each of them in the same window?
    Yes, you can.
    Originally posted by katasterisma
    or each window can manage just itself information ?
    No
    Originally posted by katasterisma
    But If I open new window like this my_window = window.open(... ......); I suppose that wherever I am in my javascript code I should be able to obtain information from that variable, or not?
    If yes, how??
    my_window then becomes (in the parent window) like the window object in the child window. So you can call my_window.locat ion.href and that should give you the URL of the child window.

    Comment

    • katasterisma
      New Member
      • Jun 2007
      • 9

      #17
      I am really not able to make it work

      My code:

      projectTest.htm l
      Code:
      <head>
      <title>lucio palmitessa</title>
      <meta http-equiv="Content-type" content='text/html; charset="UTF-8"' />
      
      <link rel="stylesheet" type="text/css" href="/style-p.css" />
      <link rel="shortcut icon" href="/src/arancia.png" />
      <script type="text/javascript" src="src/javascriptTest.js" ></script>
      
      
      </head>
      <body >
      	<div id="esquerra"><!-- menu principale della sinistra-->
      	<br />
      	
      	<p><A onclick="test();">Open pop-up and grab url</a></p>
      
      	<p><a>Text 1</a> </p>
      		<div id="sinistra"></div>
      
      
      	<p><a >Text 2</a> </p>
      		<div id="iltesto"></div>
      
      	</div><!-- fine esquerra -->
      </body>
      </html>
      javascriptTest. js
      Code:
      
      var myw = true
      
      
      
      
      function pop(nome)
      {
      if(false == myw.closed)
       {
         myw.close (); 
       }
      myw = window.open("http://"+nome+"","M","width=700,height=2000,location=yes,status=yes,resizable=yes,scrollbars=yes,fullscreen=no,toolbar=yes,left=200"); 
      }
      
      function test(){
      pop('www.yahoo.it');
      
      setTimeout("timeo()",3000);
      var y=myw.location.href;
      document.getElementById('sinistra').innerHTML='url '+y;
      
      }
      
      function timeo(){
      	document.getElementById('iltesto').innerHTML='no function';
      	var x = myw.location.href;
      	alert(x);
      }
      link to test page testPage


      At this point I just don't know what's wrong.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #18
        I see what your problem is now. If you check with a URL in your own domain, it will work, but with any other domain, e.g. the Yahoo one, it wont work because of a permissions issue.

        Comment

        • katasterisma
          New Member
          • Jun 2007
          • 9

          #19
          Originally posted by acoder
          I see what your problem is now. If you check with a URL in your own domain, it will work, but with any other domain, e.g. the Yahoo one, it wont work because of a permissions issue.

          So time wasted uselessly, I am sorry, I thought that get back the domain was not a problem (with variables it's different story)!

          Thank you

          Comment

          Working...