How to click a button from one tab to another?

  • 0

    Created an HTML page with two buttons. One opens "" in a new tab, the other closes this tab. But you need not just open Google in a new tab, but also find and press the button "I'm lucky!" Everything works individually. Google opens in a new tab but how to click the "I'm lucky!" Button. If I try it from the console, it is pressed, and if it does not work by pressing the original button. Tell me how to do this?
    JavaScript Anonymous, Jun 7, 2020

  • 2 Answers
  • 0
    With a browser plugin, plugins have more access to pages, for example Tampermonkey or Greasemonkey for chrome or firefox, respectively.

  • 0
    You cannot reach the page if its address does not fall under the Same Origin Policy

    Modified code from previous author because for page on other domains onload is empty

    $('#btn').click(function() {
    var popup ='', '_blank', 'width=500,height=500');
    setTimeout(function(){ console.log("1", popup.document)}, 2000)

    There was a site called "let me google for you" and it was quite popular before these restrictions were introduced, they did exactly what you are trying to do.

    This site is currently down because Same origin policy

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!