Closed jsrdzhk closed 6 years ago
There is no current way to do that and it's not something I have a need for.
It would require custom coding. I would have to charge to add this. If you want to discuss that then please contact info@tuarua.co.uk for a quote.
@tuarua I'm sorry but I have to implement this feature by myself. UPDATE:I have written some code to add this feature but I have some troubles to package the webviewane.So I can't test what I modified. Here's what I did: 1.modify the CefView.cs and MainController.cs 2.add a string property acceptLanguage to Settings.as 3.build the WebViewANELib and get the WebViewANELib.dll 4.build the WebViewANE and get the WebViewANE.dll with some errors occurred,these errors are all about cannot find some files to copy. 5.I copied WebViewANELib.dll WebViewANE.dll extension.xml(extension descriptor file) and library.swf into the directory of adt.bat.Then I tried to package all of them with this command: adt -package -target ane WebViewANE.ane extension.xml -swc WebViewANE.swc -platform default -C platform/default library.swf.The returned result is 'Missing implementation for platform: Android-x86'.
Can you show me a tutorial about how to join this project and add new features to it?Thanks very much!
Your adt command is wrong. Re-use what is already there.
This builds the dlls, creates the ANE and copies dlls to AIR bin folder
Make sure you follow the instructions here to make the changes you need for the headers https://github.com/cefsharp/CefSharp/issues/534#issuecomment-60694502
Thanks for your response!I followed your instructions and modified the accept-language by these code:
CefReturnValue IRequestHandler.OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser bsrowser, IFrame frame,
IRequest request, IRequestCallback callback)
{
var headers = request.Headers;
headers["Accept-Language"] = "zh-CN";
request.Headers = headers;
return CefReturnValue.Continue;
}
That successfully changed the cef's request header and the website displayed language became Chinese.I tried to improve this method so that I can specify the accept-language from as code.Here's the change:
CefReturnValue IRequestHandler.OnBeforeResourceLoad(IWebBrowser browserControl, IBrowser bsrowser, IFrame frame,
IRequest request, IRequestCallback callback)
{
var headers = request.Headers;
headers["Accept-Language"] = _acceptLanguage;
request.Headers = headers;
return CefReturnValue.Continue;
}
_acceptLanguage was fetched from as code by AcceptLanguage = settingFre.GetProp()
and I changed the contructor of RequestHandler
into
public RequestHandler(ArrayList whiteList, ArrayList blackList, string acceptLanguage) {
_whiteList = whiteList;
_blackList = blackList;
_acceptLanguage = acceptLanguage;
}
In the CefView.cs,I added the member variable public string AcceptLanguage { private get; set; }
After these changes,I found no matter how I change the property acceptLanguage in as,the accept-language request header was always zh-CN.
UPDATE:I just modified AcceptLanguageList
in CefSharp and it works.Thanks for your help!If you will,I can commit my little amount of modifications to your project.
Thanks for investigating and providing details of the changes.
I didn't know about CefSettings.AcceptLanguageList
As it is a small change I have added it to the next version 1.9.0 which I will release 15/09/18
@tuarua I found the webview was always displayed on the top of the app and everything was covered by the webview instance.Is it possible to show some notifications by using as code?And I'm interested in the internal principle of this project.Should I start with your another project FreSharp?
@tuarua Sorry for my stupid question.I'm a novice for GitHub and I only saw the HOME page of the wiki.I thought the Wiki had only one page before reding your answer......
Answer the below. DO NOT DELETE!!
Have you read the Wiki carefully?
What version of the product are you using?
On what operating system? Win7
If Windows is the AIR app 32bit or 64bit**? 32bit
Which IDE are you using? Flash Develop
Which version of AIR are you using? 30
Hello,I known ISSUE is only for bugs and I am sorry to disturb you.It seems that webviewane has no way to modify the accept-language.I tried my best to find this feature but failed.Please tell me the way to modify the accept-languages if it exists.Or please add this feature if you will.Thanks anyway!