Page 1 of 1

How to put Accept-Language into Browser-Widget requests?

Posted: Wed May 26, 2021 2:32 pm
by TorstenHolmer
Hi,

I want to tell the browser widget that it should ask the website for a representation in a specific language. As I have understood so far, this information has to be put in the httpheader: https://developer.mozilla.org/en-US/doc ... t-Language

But how can I configure the browser widget in this way like e.g. Firefox did it in Settings / Preferred language?

Cheers,
Torsten

Re: How to put Accept-Language into Browser-Widget requests?

Posted: Wed May 26, 2021 4:15 pm
by andresdt
hello TorstenHolmer

Use the httpHeaders property to provide custom headers when interacting with servers that require them.

look in the dictionary.

I think this is what you need

Re: How to put Accept-Language into Browser-Widget requests?

Posted: Wed May 26, 2021 4:18 pm
by andresdt
I think here is the answer to your question.

Code: Select all

put "ABCD" into clientId
put "1234" into clientSecret

put "Authorization: Basic" && base64Encode("clientId:clientSecret") & return & "Content-Type: application/json" & return & "Cache-Control: no-cache"  into tHeader 
set the httpHeaders to tHeader

post receiveMomoRequest to url    "https://server/v1/merchantaccount/merchants/HMXXXXXX/receive"
I copied this code from: https://stackoverflow.com/a/49675084/12042538

Re: How to put Accept-Language into Browser-Widget requests?

Posted: Thu May 27, 2021 3:05 am
by TorstenHolmer
Hi andresdt,

thanks for the information but maybe I explained my problem not detailed enough. I want to navigate and load webpages with the browser widget and I am not using POST or GET command to get the page content.

So the problem is: how to tell the browser widget that it should use the httpheader definitions?

Cheers,
Torsten

Re: How to put Accept-Language into Browser-Widget requests?

Posted: Sat May 29, 2021 4:34 pm
by TorstenHolmer
I made some progress but also saw a strange behavior of the widget:

If you create a stack with browser widget und a buttion with this script:

Code: Select all

on mouseup
   set the httpheaders to "Accept-Languages: fr"
   set the url of widget "Browser" to "https://manytools.org/http-html-text/browser-language/"
end mouseup
Than the reply of the site will be the language setting of your computer ( in my case de-de) but not the language of the httpheaders.

Does anybody knows why?

It seems, that setting httpheaders does not work together with the browser widget.

Cheers,
Torsten