I'm going to write some things here that can seem harsh, rough and even gross. That's not the intention, so please do not feel offended. It is for your good, and for the sake of those who have the same doubt as you.
I have some links that I frequently access at work, so I've created a page with all those links for easy access.
With time and experience you will discover that browser bookmarks are a much easier and more convenient way to quickly access the pages that interest you.
Some of these sites I have a username and password to access. What I wanted to do was click the link and the user and password fields are populated, maybe using javascript.
To do this with you either, you would have to inject Javascript into those pages, or run them on a iFrame
to manipulate it from the outside. Both ways to achieve this are attack vectors, so sites have defense mechanisms against this that are enabled by default. If you want to dig deeper into the subject, start with this question:
What is CSRF attack and what damage can it cause?
And then search for CORS , XSS and CSRF in that order.
I thought of creating a script in js that "read" the page and enter the access data in the login and password fields, then I would put a trigger on the attribute to execute this script when clicking the link. But I do not know how I can do this.
There is a more practical mechanism, which is the automatic completion of passwords by the browser. This feature is enabled by default. If it is not enabled, you can enable it easily. Depending on the browser, your passwords will even be saved to the cloud, so you can reuse autocompletion on other computers and devices.
There is no problem with loss of confidentiality or vulnerability, because the page I created is saved on my machine and I only use it.
Quite the opposite. Browser and cloud password storage ensures security through native operating system encryption and features.
If you're going to reinvent the wheel and save passwords on a page, right in the source code ... I imagine you did not think about encrypting them, right? Just a malicious co-worker discover that you have this file that you will have lost the confidentiality of these passwords. Bonus of lost passwords if network admin can access your machine remotely. Even if you send this password file to yourself by email to take advantage of it on another computer, or if you have saved it to a USB flash drive.
Do not try to create a solution to a problem if you do not have complete mastery of the problem, okay? But be sure to study and get better because of it. I suggest you study a lot of information security. You'll find bigger challenges than the one you have now, and it will be fun to solve them.