Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

press a button on external site with javascript

is there a way to press a button on external site with javascript and/or jquery? Like I open a new window like this:

windowObjectReference = window.open("http://some_site.html","name"); 

Then I want to press a button on this site. Something like this:

windowObjectReference.button.click();

Or:

name.button.click();
like image 350
user1142908 Avatar asked Feb 28 '26 17:02

user1142908


1 Answers

It would be a huge security violation if a browser would let you do that from the script placed on your own website.

So, no, this cannot be done, and should not be possible.

But...

If both sites belong to you (you have access to their code), you can pass a parameter (eg. as a hash within URL), then the target website may read it and fire the event you mentioned (name.button.click()).

like image 179
Tadeck Avatar answered Mar 03 '26 07:03

Tadeck



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!