How to get the url of the page that is currently loading in an iframe

I have a requirement that in my application, when a button is clicked, I have to load another application with the same template that I used for my application.

So, by clicking a button in my application, I used one intermediate page in that using an iframe, I passed this url to the external application. Works great.

But the problem is with an external application that is out of my control when I click a button that goes to the next page. On this page, I want to hide the button.

I did this using the div tag color as white and set the positions.

But the problem lies in all the pages in the same position that affects. So I want to get the url of the page being loaded into the iframe in the second or third click of the external application, so that I can use some conditions to hide the control.

0


source to share


1 answer


You can use Javascript. Give the iframe an id

var iframe = document.getElementById(id);

      

The URL is accessible via the "src" attribute:



iframe.src

      

Additional Information

0


source







All Articles