If a new web page is loaded into iframe (by user clicking a link in the web page in the iframe, for example), how can I retrieve the url of the current page? Will that be a parameter to onBeforeLoad or onAfterLoad?
Hello @dethier ,
Use the Location
object, which is a property of the Window
object. You can create a new Location object that has the current URL as follows:
getWindow().location.href
(please pay attention to possible limitations for cross-origin requests)
Here is an example: https://snippet.webix.com/xpxto8kg
There you can define src and get it from the config
.
Also, you can use onAfterLoad event of the iframe view. While it doesn’t provide a separate parameter for the current URL, you can use code like next to fetch the info.
on:{
onAfterLoad : function(){
alert(this.getIframe().src);
}
}