I've been trying to figure out how to write a greasemo开发者_开发技巧nkey script to log me into a 401 html page. When I'm asked for a username and password in a pop up box (401 Request I believe), i want it to automatically log me in (my company's design sites are all the same username and password).
Any help?
Also, save passwords won't work because I'm dealing with new websites everyday (probably go to 1-2 new design sites a day.)
I don't believe this is possible, not with GreaseMoney at least. It has no way to check the returned HTTP status code unless you make a request through it's xmlhttpRequest function. And if you're going to new sites everyday, then how is it suppose to know which ones it's suppose to log you into? Sending your username and password to any site that asks for authentication is a bad idea.
-Edit-
If you really want to do this, I think I may have thought of a way, albeit sloppy. Setup a custom page for 401 responses. Add some sort of special text to that page that you wouldn't expect to find anywhere else on the internet. Then have GreaseMonkey look for that text. If it finds it, redirect to the same URL, but add username:password@ in front of it.
So,
http://www.example.com/secret/dir/
becomes
http://user:pass@www.example.com/secret/dir/
Then, when you're asked for your username and password, just click cancel.
Once again, I wouldn't really recommend this because if someone were to figure out why that weird super special text is in the page, they could trick you into doing this on their site and they would get your username and password.
You'd have to use a FF extension to achieve what you want..
精彩评论