Results 1 to 12 of 12

Thread: TWebBrowser Autopost help needed

  1. #1
    Join Date
    Jul 2010
    Posts
    37

    TWebBrowser Autopost help needed

    If Web-Browser is created, can the login and password can be typed automatically?

  2. #2
    Join Date
    Apr 2008
    Posts
    4,642

    Re: TWebBrowser, Autopost.

    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.

  3. #3
    Join Date
    Jul 2010
    Posts
    37

    Re: TWebBrowser Autopost help needed

    But, my question sounds different.

  4. #4
    Join Date
    Dec 2007
    Posts
    1,736

    Re: TWebBrowser Autopost help needed

    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
    }

  5. #5
    nealrelics Guest

    Re: TWebBrowser Autopost help needed

    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

  6. #6
    Join Date
    Jul 2010
    Posts
    37

    Re: TWebBrowser Autopost help needed

    Where did you take the information from? Why should I use proxy? Can you advise best Delphi forums?

  7. #7
    Join Date
    Dec 2007
    Posts
    2,291

    Re: TWebBrowser Autopost help needed

    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;

  8. #8
    Join Date
    Jul 2010
    Posts
    37

    Re: TWebBrowser Autopost help needed

    OK. Thanks. I will try it tomorrow. Can you advise some Delphi specialized forums?

  9. #9
    Join Date
    Dec 2007
    Posts
    2,291

    Re: TWebBrowser Autopost help needed

    Quote Originally Posted by alex198555 View Post
    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.

  10. #10
    Join Date
    Jul 2010
    Posts
    37

    Re: TWebBrowser Autopost help needed

    Still, I couldn't get it?!

  11. #11
    Join Date
    Dec 2007
    Posts
    2,291

    Re: TWebBrowser Autopost help needed

    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.

  12. #12
    Join Date
    Jul 2010
    Posts
    37

    Re: TWebBrowser Autopost help needed

    It's web-site only for creating different forums, not specialized ones.

Similar Threads

  1. Delphi, TWebBrowser & Java Scripts.
    By alex198555 in forum Software Development
    Replies: 1
    Last Post: 28-07-2010, 11:23 AM
  2. TWebBrowser Auto Resize?
    By alex198555 in forum Software Development
    Replies: 1
    Last Post: 27-07-2010, 09:42 AM
  3. Delphi, TWebBrowser, Disable Scrollbars???
    By alex198555 in forum Software Development
    Replies: 4
    Last Post: 26-07-2010, 11:02 PM
  4. Delphi, TWebBrowser, Auto-Refresh???
    By alex198555 in forum Software Development
    Replies: 3
    Last Post: 22-07-2010, 10:41 AM
  5. TWebBrowser, Troubles
    By alex198555 in forum Windows Software
    Replies: 2
    Last Post: 14-07-2010, 11:04 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,715,536,253.16061 seconds with 17 queries