Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

invoke my jquery function on a webpage opened in iframe

Tags:

jquery

I want to click a button which is on webpage opened in iframe based on class selector from my parent page.

I tried this:

$.each($('.classname'), function(i, el){
  setTimeout(function(){
  $(el).trigger('click');
  },30000 + ( i * 30000 ));
});

but no success. How can i achieve this?

like image 390
kritikaTalwar Avatar asked Jan 14 '17 05:01

kritikaTalwar


1 Answers

If the src of the iframe is pointing to a different domain, due to security reasons, you will not be able to access the contents of the iframe in javascript.

like image 173
Billy Fischbach Avatar answered Nov 15 '22 21:11

Billy Fischbach