Search code examples
javascriptjavascript-objectsdom-eventsbrowser-console

Javascript Console Commands Not Working After Ajax Sending Back in Page


I'm controlling a website in Chrome developer console. There is a form and a submit button for sending the form via ajax (I guess) without refreshing the page. The form is resetting after sending information.

I assigned some attributes to a form element in the page with Javascript. There are some processes that do not matter, and I'm sending the form but the attributes of the elements are resetting in the new form. I am forced into calling the same scripts again.

Is there anyway for global valid command with console coding, because the webpage isn't mine? (In pure-JavaScript)


Solution

  • there are a couple ways to achieve this.

    the easiest: will probably be to create a snippet in the web developer tools, and run it from there.

    Chrome Snippet Example

    Another manner would be to create a google extension (with 'declarativeContent' and 'activeTab' permissions) that can inject content script or execute script on a page.

    you can find more information on developing chrome extensions and background page events here: https://developer.chrome.com/extensions/background_pages