If Web-Browser is created, can the login and password can be typed automatically?
If Web-Browser is created, can the login and password can be typed automatically?
It depends on the autosave feature embedded with the application. Inorder to work out it is essential that you process for the change. Make the option to be as remember me. As it is been done you need to check out for the thing and make the implementation that is needed.
But, my question sounds different.
This was given on another site which might help you, to add proxy authentication support you must:
1. Have a proxy username and password (strings)
2. Merge these strings with a ':' between as:
totalString := UserName + ':' + PassWord
3. Base-64 encode totalString
4. On the OnAboutToSend event of the NMHTTP, add
'Proxy-authorization: ' + totalString
to the http header
The routine below encodes the Proxy username/password
to a string accepted by the proxy
}
uses Forms,Classes,NMUUE; // Don't forget these !
function EncodeAuth(username, password: string): string;
var uu: TNMUUProcessor;
si, so: TStringStream;
decoded: string;
encoded: string;
begin
decoded := username+':'+password; // Usernameassword
SetLength(encoded, 20 * length(decoded)); // Estimate len
uu := TNMUUProcessor.Create(Application); // UU Processor
si := TStringStream.Create(decoded); // Input
so := TStringStream.Create(encoded); // Output
uu.InputStream := si;
uu.OutputStream := so;
uu.Method := uuMime;
uu.Encode; // Decode
result := so.ReadString(255); // Read Result
result := copy(result, 1, pos(#13, result) - 1); // No CRLF
si.free; // Free objects
so.free;
uu.free;
end;
{
The OnAboutToSend event on the NMHTTP should look like:
}
procedure TForm1.NMHTTP1AboutToSend(Sender: TObject);
begin
if username <> '' then
NMHTTP1.SendHeader.Insert(2, 'Proxy-authorization: ' +
EncodeAuth(username, password));
end;
{
We are inserting the Proxy-authorization token
to the 3rd position as it is a valid position to
place it
}
Web Browser control has a property Script Errors Suppressed. Setting this property to true does actually a bit more than what it is supposed to. This is not only disable dialog script error, but the dialog box to connect to a secure Web site use certificates. What if we still want this feature
Where did you take the information from? Why should I use proxy? Can you advise best Delphi forums?
Below is the code with the submit included:
Code:procedure TForm1.Button2Click(Sender: TObject); var Doc: IHTMLDocument2; I: Integer; Element: OleVariant; Elements: IHTMLElementCollection; Sub: Variant; begin Doc := WebBrowser1.Document as IHTMLDocument2; Elements := Doc.All; for I := 0 to Elements.length - 1 do begin Element := Elements.item(I, varEmpty); if (UpperCase(Element.tagName) = 'INPUT') and (UpperCase(Element.Type) = 'TEXT') then begin // You should check with the input name or id, in this case login if (Element.name = 'txtUserID') then Element.value := edUser.Text; // You should check with the input name or id, in this case password if (Element.name = 'ipPIN') then Element.value := edPassword.Text; end; end; Sub := WebBrowser1.Document; Sub.loginForm.Submit(); end;
OK. Thanks. I will try it tomorrow. Can you advise some Delphi specialized forums?
Yes, I think you can go to delphiforums.com which seems to the official forums of delphi. But seriously speaking the front end home page of the delphi forums looks like a social networking forums with spotlights for featured members and by the looks of the headers and the footers.
Still, I couldn't get it?!
What you didnt get? You said you wanted information about some Delphi specialized forums which I have written in my earlier post by pointing you to go for delphiforums.com. Another thing is there is million's of community out their which are related to delphi only, if you search on google.
It's web-site only for creating different forums, not specialized ones.
Bookmarks