user7100805
user7100805

Reputation:

Insert text in a new window with javascript

I want to create a new window with Twitter's intent page and then insert text into a textarea. This is my code but it is not working.

var myWindow = window.open("https://twitter.com/intent/tweet");

myWindow.onload = function() {
  myWindow.document.getElementById("status").innerHTML="Hey you!!";
}

Upvotes: 0

Views: 218

Answers (1)

Quentin
Quentin

Reputation: 944013

You can't use JavaScript to modify pages on other people's websites. It would be a huge security problem if it were possible.

Read Twitter's developer documentation. It shows you how to set default text for an intent:

<a href="https://twitter.com/intent/tweet?text=Hey+you!!">…</a>

Upvotes: 3

Related Questions