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

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
TorstenHolmer
Posts: 57
Joined: Mon Oct 28, 2013 1:23 pm
Location: Dresden, Germany

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

Post by TorstenHolmer » Wed May 26, 2021 2:32 pm

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

andresdt
Posts: 146
Joined: Fri Aug 16, 2019 7:51 pm

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

Post by andresdt » Wed May 26, 2021 4:15 pm

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

andresdt
Posts: 146
Joined: Fri Aug 16, 2019 7:51 pm

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

Post by andresdt » Wed May 26, 2021 4:18 pm

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

TorstenHolmer
Posts: 57
Joined: Mon Oct 28, 2013 1:23 pm
Location: Dresden, Germany

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

Post by TorstenHolmer » Thu May 27, 2021 3:05 am

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

TorstenHolmer
Posts: 57
Joined: Mon Oct 28, 2013 1:23 pm
Location: Dresden, Germany

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

Post by TorstenHolmer » Sat May 29, 2021 4:34 pm

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

Post Reply

Return to “Internet”