Set conditional CustromUserAgent

Hi,
Is it possible to set conditional CustromUserAgent by for application?

It would be nice to set it in Scripts in OnBeforeNavigate.

Is it possible to use this scenario? :

  1. Applcation index.php set global variable eg CUA (CustomUserAgent)
  2. Aplication redirect to https://example.com
  3. Every request to only https://example.com send request CustomUserAgent saved in global variable CUA
    is it possible?

No, you can only define CustomUserAgent at design time yet.

Hi,
Will be possible to set CustomUserAgent athoc next version?

Since we’ve switched to a more recent Chromium version, we’ll check whether this can be implemented. Or maybe the ability to add custom headers (and thus passing your own data to a remote server for instance when browsing pages).

Thank you veeeery much, i see you add it to EXO2018 :smiley:

Is it possible to send custom headers only for regexp domain, that custom headers don’t leak to other websites? :slight_smile:

Should be possible with HEScript and events in the UserMain script. We would have to check the browsed URL and modify the header. We’ll check if this can work.

If you find time to check if it is posible please write here solution.

Thank you very very much :slight_smile:

Hi,
How to catch browsed URL to variable?

Use the pre-defined HEScript events in your UserMain script.

certainly HEScript is a powerful tool, but unfortunately I can not use it. I do not know what EVENTS are, where is the documentation for these EVENTS and how to call them. I am asking you to write the HESCRIPT documentation so that you can learn it. On the other hand, maybe you could use PHP, because people who can understand PHP can hardly understand HESCRIPT.

My request is also to help you with setting conditional CustomUserAgent
Thank you.

Documentation already exists. https://www.exeoutput.com/help/scripttemplates (just searched for EVENTS in the doc…)
PHP isn’t useful for controlling UI. We also kept HEScript because ExeOutput was derivated from our other software HTMLEXE.
See also http://www.exeoutput.com/help/addscript

I know that i should use events OnBeforeNavigate, OnStartMainWindow, but i don’t know how can I catch URL which will be displayed. Maybe my English is bad, but i am asking about it. How to get URL and how to use regexp to compare URL to pattern.

It is very important to help me with this (and probably others) because, when I drag and drop url to application window i see website. This way it is easy hack see all the headers which we sent on drag&drop url :frowning:

Please, write some working code :frowning:
Please, please, please.
I am trying and trying and can’t handle this case :frowning:

Here you go:

function OnBeforeNavigate(NewURL, TargetFrame: String): Boolean;
begin          
 // Before the application displays a page. Set Result to True to stop the operation.

if Pos("http://heserver", LowerCase(newURL)) > 0 then
begin
 SetUIProp("crm", "CustomHeaderName", "My-SystemID");
 SetUIProp("crm", "CustomHeaderValue", MD5OfAString("MySystemID" + GetManualHardwareID(2)));
end
else
begin
 SetUIProp("crm", "CustomHeaderName", "");                          
 SetUIProp("crm", "CustomHeaderValue", "");
end;
                 
 Result := False;
end;   

Replace http://heserver by the URL you want (in lowercase) in

if Pos("http://heserver", LowerCase(newURL)) > 0 then

Thus, the custom header with unique system ID will only work on a given site (here http://heserver)

1 Like

Thank you very very much :slight_smile:
It is working like a harm :slight_smile:

@gdgsupport I recently tried this script on exeOutput for php but I keep getting this error;
Unknown identifier or variable is not declared: 'My'. Source position 2.33. & This error;
Unknown identifier or variable is not declared: 'HashValue'. Source position 2.63.

How can I resolved this issue. Although I have already tried replacing the variables and also added the number of quotes to wrap around the variables. which executes but I don’t see the custom values appearing in the header whenever I use getallheader() PHP built in function

Yes, I tried last night and had the same errors too…

Any fix for this?

thanks!

We finally managed to find the cause of the problem and a fix will be included into the next update.