Re: how do you write something to someone elses page and submit with
javascript?
Newbie wrote:
how do you write something to someone elses page and submit with
javascript? I am trying to auto login to a user account as the page is
loaded.
First off, Java != JavaScript. The two are as different as French and
Spanish.
In any case, the answer is "you don't do it." HTML forms (especially
login pages) tend to be posted using the HTTP POST. In the specific case
of logins, the typical sequence of events involves saving a cookie to
the local user's computer. The only way in JavaScript to be able to
manipulate other pages would be via frames (specifically iframe) or
XMLHttpRequest (XHR, for short).
That said, in most if not all modern browsers, cross-domain JavaScript
access to pages is severely restricted due to the numerous security
vulnerabilities that it opens up--the so-called XSS (cross-site
scripting) vulnerabilities. Recently, a specification came out that
would allow sites to explicitly state who may load them via this
mechanisms, the Access-Control headers.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth