swift - ios中webview如何每次请求都带上自己的header或anent
PHPz
PHPz 2017-04-18 09:14:55
0
1
279
> let request = NSMutableURLRequest(URL: nsurl!);
> request.setValue("test", forHTTPHeaderField: "deviceID")
> self.loadRequest(request)

使用NSMutableURLRequest可以第一次打开webview的时候带上自己的header,但是点击一个连接跳转到下一个界面后,下一个界面就不带我这个header了, 如何每次请求都带上自己的header。

    
    
PHPz
PHPz

学习是最好的投资!

reply all(1)
大家讲道理

Implement your own defined NSURLProtocol, then

[NSURLProtocol registerClass:YourClass];

Only provide ideas, you can check Apple’s official documentation for specific implementation.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template