开发者

Language selection in website/browser for localized advertisment

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜