Set conditional CustromUserAgent


#1

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?

#2

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


#3

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


#4

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).


#5

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:


#6

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.


#7

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

Thank you very very much :slight_smile:


#8

Hi,
How to catch browsed URL to variable?


#9

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


#10

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.


#11

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


#12

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:


#13

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


#14

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)


#15

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