Authored by gaoqiang xu

增加一个请求处理前的回调 reviewed by 枪兵

@@ -110,6 +110,15 @@ @@ -110,6 +110,15 @@
110 */ 110 */
111 - (void)explorerDidDetectParameters:(NSDictionary *)params; 111 - (void)explorerDidDetectParameters:(NSDictionary *)params;
112 112
  113 +/**
  114 + @brief 将要加载请求前的回调
  115 +
  116 + @param request 请求
  117 +
  118 + @since 1.0.7
  119 + */
  120 +- (void)explorerWillLoadRequest:(NSMutableURLRequest *)request;
  121 +
113 #pragma mark Native 122 #pragma mark Native
114 /** 123 /**
115 * 本地机能是否可以被触发,默认是YES 124 * 本地机能是否可以被触发,默认是YES
@@ -211,7 +211,11 @@ static float kprogressViewRadius = 2.0f; @@ -211,7 +211,11 @@ static float kprogressViewRadius = 2.0f;
211 - (void)loadWebUrl:(NSString *)url 211 - (void)loadWebUrl:(NSString *)url
212 { 212 {
213 self.startPage = url; 213 self.startPage = url;
214 - [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]]; 214 + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
  215 + if ([self.delegate respondsToSelector:@selector(explorerWillLoadRequest:)]) {
  216 + [self.delegate explorerWillLoadRequest:request];
  217 + }
  218 + [self.webView loadRequest:request];
215 } 219 }
216 220
217 - (void)loadHTMLString:(NSString *)html 221 - (void)loadHTMLString:(NSString *)html