[iOS] add user-agent to request in embedded web view

This commit is contained in:
Aleksey Belouosv 2018-08-09 18:39:18 +03:00 committed by Aleksey Belousov
parent 9f41385500
commit 6c6f90f62c

View file

@ -1,4 +1,5 @@
#import "WebViewController.h"
#import "Framework.h"
#include "base/assert.hpp"
@ -87,9 +88,15 @@
self.webView.backgroundColor = UIColor.whiteColor;
if (self.m_htmlText)
{
[self.webView loadHTMLString:self.m_htmlText baseURL:self.m_url];
}
else
[self.webView loadRequest:[NSURLRequest requestWithURL:self.m_url]];
{
auto request = [NSMutableURLRequest requestWithURL:self.m_url];
[request setValue:@(GetPlatform().GetAppUserAgent().Get().c_str()) forHTTPHeaderField:@"User-Agent"];
[self.webView loadRequest:request];
}
}
- (void)viewDidDisappear:(BOOL)animated