title: jQuery iframe- how to get parent window URL when using an iframe?
body: <p>I have given an example.</p>
  
  <p><strong>test.html:</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
   &lt;head&gt;
     &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;
   &lt;/head&gt;
   &lt;body&gt;
     &lt;h1&gt;main window test&lt;/h1&gt;
     &lt;iframe src="./iframe.html"&gt;&lt;/iframe&gt;
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>iframe.html:</strong></p>
  
  <pre><code> &lt;!DOCTYPE html&gt;
     &lt;html&gt;
       &lt;head&gt;
         &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
       &lt;/head&gt;
       &lt;body&gt;
           &lt;h1&gt;iframe testing&lt;/h1&gt;
           &lt;script type="text/javascript"&gt;
               $(document).ready(function() {
                   alert("window.location.href"+window.location.href);
               });
           &lt;/script&gt;
        &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>In alert--> i am getting the iframe url "C:\Users\nn96589\Desktop\testfolder\iframe.html"</p>
  
  <p>but, i need the main window URL which is "C:\Users\nc96589\Desktop\testfolder\test.html"</p>
  
  <p>can anyone help me.
  Thanks in advance.</p>