iOS修改webview的UserAgent資訊.
在啟動時,比如在AppDelegate 中呼叫如下程式碼:
func addedUserAgentMsg() {
let webview = UIWebView.init(frame: CGRectZero)
let oldAgent = webview.stringByEvaluatingJavaScriptFromString("navigator.userAgent")
//print("old UA :\n\(oldAgent)")
let newAgent = oldAgent?.stringByAppendingString(" APPBuildName/APPBuildName APPVersion/2.1.0")
let dict = NSDictionary.init(objects: [newAgent!], forKeys: ["UserAgent"])
UserDefault.registerDefaults(dict as! [String : AnyObject])
}
相關文章
- iOS WebView UserAgent 獲取和設定iOSWebView
- iOS 修改webView字型iOSWebView
- iOS 下實現 webview 標題修改iOSWebView
- Swift iOS : 在webview的當前網頁上提取資訊的方法SwiftiOSWebView網頁
- iOS開發之WebViewiOSWebView
- Appium 的 ios 中 webview 問題APPiOSWebView
- Mozilla UserAgent 總結
- Swift iOS : WebView快取圖片的方法SwiftiOSWebView快取
- Flutter 與 iOS 原生 WebView 對比FlutteriOSWebView
- 修改oracle 的統計資訊Oracle
- iOS cell中webview自適應高度iOSWebView
- 爬蟲抓取UserAgent問題爬蟲
- iOS修改字型iOS
- iOS高階-WebView & JavaScript互動(附DEMO)iOSWebViewJavaScript
- 瀏覽器野史 UserAgent列傳瀏覽器
- Go 的 fake-useragent 瞭解一下Go
- 淺談 iOS Device ID 的修改iOSdev
- iOS11 更新後的修改iOS
- iOS開發 webview禁止視訊全屏播放iOSWebView
- iOS學習筆記14 網路(三)WebViewiOS筆記WebView
- iOS 【奇巧淫技】獲取webView內容高度iOSWebView
- iOS WebView生成長截圖的第三種解決方案iOSWebView
- iOS App資訊iOSAPP
- iOS修改宣告為readonly的值iOS
- iOS UITableView 修改屬性iOSUIView
- ios 修改鍵盤returniOS
- iOS防DNS汙染方案調研—WebView業務場景iOSDNSWebView
- webview的使用WebView
- Git修改commit提交資訊GitMIT
- 關於iOS Webview 載入React 靜態資源的安全問題iOSWebViewReact
- iOS中webView巢狀tableView中動態高度問題iOSWebView巢狀
- iOS UISearchBar 修改背景顏色iOSUI
- 安卓sdk webview獲取淘寶個人資訊100項,原始碼。安卓WebView原始碼
- Xposed修改硬體資訊總結
- JSP(10) - 修改商品資訊模組JS
- CentOS 6.5 修改網路卡配置資訊CentOS
- iOS使用webView載入HTML網頁連結簡單展示iOSWebViewHTML網頁
- 記一則iOS封裝SDK的開發過程之WebView與JS的互動iOS封裝WebViewJS