Bookmarklet for Logging Into Newsbank

This actually can be adopted for any login site, just by adjusting the login fields. It does require two clicks of the login script, but whatever.

javascript:(function(){
  const targetUrl = 'https://infoweb.newsbank.com/apps/news/user/librarycard?destination=easy-search%3Fp%3DNewsBank';
  
  if (window.location.href.indexOf('infoweb.newsbank.com') === -1) {
    window.location.href = targetUrl;
    return;
  }

  const form = document.querySelector('form#nbauth-library-card-form');
  if (form) {
    const fields = {
      'nbauth_library_key': 'xxxx',
      'nbauth_library_card': 'xxxxxxxx',
    };

    for (let name in fields) {
      let input = form.querySelector(`[name="${name}"]`);
      if (input) input.value = fields[name];
    }

    form.submit();
  } else {
    alert('Login form not found. Please ensure you are on the NewsBank login page.');
  }
})();

Leave a Reply

Your email address will not be published. Required fields are marked *