Arcath
Arcath

Reputation: 4391

Using JS to create a "link" to a password protected site

Quite a few of the sites that the schools I work in use have user accounts to protect the content from people who haven't paid for it which means that the users (aged 5+) have to type in some pretty weird usernames/passwords before they can do their work.

I was wondering if it possible to use Javascript to create a page that would let me do something along the lines of:

  1. Fetch the Login Page
  2. Fill out the form
  3. Submit It
  4. Redirect the user to the site

1-3 would happen in the background without the user seeing it.

In most cases these accounts are shared and the details are on displays etc... in the classrooms so there is no issue with the details being publicly accessible.

I have used Mechanize in ruby before and would imagine a solution like it but running client side.

I know that some inspection of the target site will be needed but once I have an in-principle example I should be able to tailor it to each site later.

Upvotes: 2

Views: 103

Answers (1)

David
David

Reputation: 5519

If you have a standardized browser, you should consider building a plugin for that browser, that's the easiest way to interact with the web pages. Otherwise you'll get into issues with anti-CSRF protections and cross-domain-policies.

As for the language, Chrome extensions are written in javascript and are pretty easy to build. For the other browsers I don't know.

Upvotes: 2

Related Questions