Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6822281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:38:40+00:00 2026-05-26T21:38:40+00:00

I have to write an extension for saving user credentials to my database server

  • 0

I have to write an extension for saving user credentials to my database server (like in LastPass). How can I catch submit action from authentication form on active tab to grab entered login and password for saving using my extension and show dialog to a user, if he wants to save credentials or not?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:38:41+00:00Added an answer on May 26, 2026 at 9:38 pm

    Add a content script in your manifest and set it to run on some webpage:

    "content_scripts": [{
        "matches": ["http://*.example.com/*"],
        "js": ["form_submits.js"],
        "run_at": "document_start"
    }]
    

    Also add permissions:

    "permissions": [
        "tabs", "http://*.example.com/*"
    ],
    

    In this content script listen to event “onsubmit” on forms, then contact with your extension using chrome.extension.sendRequest():

    for (var i = 0; i < document.forms.length; i++) {
        document.forms[i].addEventListener("submit", function(){
            var form = this.form;
            var data = [form.elements["user"], form.elements["password"]];
            // contact with your background page and send the form data.
            chrome.extension.sendRequest({'name':'form_submit', 'data':data}, function(){ /* callback from request */ }, false);
        });
    }
    

    In your background script add listener to these calls:

    chrome.runtime.onMessage.addListener(function(request, sender, callback) {
        switch (request.name) {
             case 'form_submit':
                 var data = request.data;
                 // do something with your form credentials.
                 break;
         }
    });
    

    ****Edited.****

    You could also execute JavaScript directly on current active Tab and add form submit listeners:

    First get the current window and active tab:

    chrome.windows.getCurrent(function callback)
    chrome.tabs.getSelected(integer windowId, function callback)
    

    http://code.google.com/chrome/extensions/windows.html#method-getCurrent

    http://code.google.com/chrome/extensions/tabs.html#method-getSelected

    Then execute JavaScript in it:

    chrome.tabs.executeScript(integer tabId, object details, function callback)
    

    http://code.google.com/chrome/extensions/tabs.html#method-executeScript

    A comprehensive Google Chrome extensions API is here:

    http://code.google.com/chrome/extensions/getstarted.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have file with jspx extension i write javascript like function isNumber(inputId){ var value
How can I determine if I have write permission on a remote machine in
I have to write a component that re-creates SQL Server tables (structure and data)
I'm trying to write an extension method that I can use to copy values
I am trying to write an extension that can access the TextUndoHistory of an
I would like to write an extension method for a generic type, with additional
I want to be able to write extension methods so that I can say:
I am trying to write an extension installer, but have to locate the prerequisite
Hello every one this is basically extension to my previous question. i have write
I am trying to check if I have write access to a specific key

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.