-1

How to forcefully click on a button in an iframe using jQuery or PHP?

example

<iframe src="www.google.com"></iframe>

I want to press the button or anchor tag in that iframe.

And also change anchor tag target -> '_self'

Arvind Kumar Avinash
  • 71,965
  • 6
  • 74
  • 110
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107

3 Answers3

1

Expanding on "not possible"...

The "Same origin policies" apply: your only way of communicating with the contents of iframes that come from another [domain|subdomain|protocol|port] is through the postMessage API, which of course requires the other part (the document inside the iframe) to listen to your messages. This means that unless you're a google employee with access to the search frontend, this won't be possible.

If you work at google and want to press a button forcefully, I recommend standing with your foot on your mouse: your weight will help push it with more strength.

Roman
  • 5,888
  • 26
  • 47
0

Not possible. Blocked by Browsers for security concerns.

rahul maindargi
  • 5,359
  • 2
  • 16
  • 23
0

On serverside you could use CasperJS to click some stuff inside an iFrame. See here How do I access an iframe from CasperJS?

Community
  • 1
  • 1
Johnny000
  • 2,058
  • 5
  • 30
  • 59