开发者

Language selection in website/browser for localized advertisment

开发者 https://www.devze.com 2023-02-02 15:26 出处:网络
Unfortunately Amazon.com/.de do have separated partner-programs, so that there is no ready to use script for websites to switch their advertisements according to 开发者_开发百科the IP address or the b

Unfortunately Amazon.com/.de do have separated partner-programs, so that there is no ready to use script for websites to switch their advertisements according to 开发者_开发百科the IP address or the browser language selection.

So I would like to do that in PHP or in JS, but I don't know how to do that. It starts hoe to get the language selection from the browser, and then I would like to ask what would be more flexible.

I would say that JavaScript would be more flexible because you can better switch it's code in case you have to alter something.

Could you give me some hints?


I think you can use navigator.userLanguage and navigator.language in JavaScript to do this. There is a small example at Java2s.com

If you want to do this via php, use $_SERVER['HTTP_ACCEPT_LANGUAGE'];.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号