Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

TTMSLCLCloudBase What Agent for macOS Cocoa

 Post Reply Post Reply
Author
Black Kevin View Drop Down
Member
Member
Avatar

Joined: 23 Dec 2013
Posts: 86
Post Options Post Options   Quote Black Kevin Quote  Post ReplyReply Direct Link To This Post Topic: TTMSLCLCloudBase What Agent for macOS Cocoa
    Posted: 25 Feb 2019 at 2:02am
This question would equally apply to the TMS FMX Cloud Pack.

There is a property  of the TTMSLCLCloudBase object that is Agent which describes the Browser properties to be used. In the past with Windows I have used this regardless:

      {$IFDEF MSWINDOWS}
       CloudBase.Agent := 'Mozilla/5.001 (windows; U; NT4.0; en-US; rv:1.0) Gecko/25250101';
      {$ENDIF MSWINDOWS}

I have no idea what to use with DARWIN/MACOS. For example, I could use one of the hundreds of Safari agents, but which one. An example is below:

      {$IFDEF DARWIN}
       CloudBase.Agent := 'Safari/13605.1.33.1.4 CFNetwork/897.15 Darwin/17.5.0 (x86_64)';
      {$ENDIF DARWIN}     

These all seem to be Safari Version and OS Version specific so I'm not keen just picking one since I cannot guarantee the version of macOS or the version of Safari that users of the software might have installed.
  1. Is the correct Agent discoverable in code somehow (if so do you have a sample)?
  2. How do you suggest I determine the correct Agent (on a DARWIN/Safari system)?
  3. What Agent (for DARWIN/Safari) do you recommend?
Kevin
Back to Top
Black Kevin View Drop Down
Member
Member
Avatar

Joined: 23 Dec 2013
Posts: 86
Post Options Post Options   Quote Black Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 25 Feb 2019 at 2:30am
I've found this in an earlier post:
To see the user agent, add the web unit to the uses list and write:

procedure TForm1.WebButton1Click(Sender: TObject);
begin
  caption := window.navigator.userAgent;
end;
So I cannot find Window.Navigator. Gotta say, comments like 'add the web unit' are petty useless, why not just put the EXACT reference in the code, at least then I'd know what to look for:
 
uses
  whateverthehellthewebunitis;   <<<<<--------------
...
...
procedure TForm1.WebButton1Click(Sender: TObject);
begin
  caption := window.navigator.userAgent;
end;
My point is, this is 'probably' the solution I'm looking for, but where is the 'web' unit. I have already added fpweb (the supposed web unit) to no avail and there is no unit called 'web'.

Can someone please advise the 'actual' name of the web unit to put in the uses clause?

Kevin

Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 8225
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 25 Feb 2019 at 10:49am
I see your post in the LCL cloud pack forum refers to a post from us that was made in relationship to TMS WEB Core. What applies to TMS WEB Core, i.e. window.navigator.userAgent does not apply to LCL Cloud Pack.
With respect to the agent, this should for most REST services not be relevant and you can specify your own agent name. The agent is what the REST service will see and think the requests are coming from and typically a REST server does not pay attention to this. 
Back to Top
Black Kevin View Drop Down
Member
Member
Avatar

Joined: 23 Dec 2013
Posts: 86
Post Options Post Options   Quote Black Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 26 Feb 2019 at 3:44am
@Bruno,

OK, that makes it easy, I was just going off your example code for the cloud pack that sets the 'agent' and assumed it was necessary. If not necessary I'll leave it at what I have, Thanks for the response.

Kevin
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down