Get iframe url variable from inside the iframe
<p>I want to use jquery/javascript if possible and grab a url variable frim inside the iframe</p>

<p>my iframe link looks like the below - the source changes dynamically</p>

<pre><code>&lt;iframe class="box" src="lightbox.html?img=images/lightbox/blue-shoes.jpg" scrolling="no" frameborder="0"&gt;&lt;/iframe&gt;
</code></pre>

<p>Then, from inside the lightbox.html iframe - I want to grab the img (images/lightbox/blue-shoes.jpg) variable and change the source of an image</p>

<p>problem is - I cant figure out how to grab the iframe source url variable from inside the iframe</p>

<p>I am trying to avoid using php</p>

<p>I have used this for something similiar but cant get it to work</p>

<pre><code>function getUrlVars() {
var vars = {};
var parts = document.referrer.replace(/[?&amp;]+([^=&amp;]+)=([^&amp;]*)/gi, function(m,key,value) {
    vars[key] = value;
});
return vars;
}
var first = getUrlVars()["ref"];
</code></pre>
