最近在做一些hybird框架的项目,对于embed的UIWebView,其宽度一般由Native app 指定,对于HTML页面

 

[html] 
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> 

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">


其中若是width指定为device-width,那么embed的UIWebView的宽不应设置小于device-width的值,如ipad的宽为768

 

 

在webView中查看HTML页面源代码

[cpp] 
- (void)webViewDidFinishLoad:(UIWebView *)webView_ { 
    NSString *jsToGetHTMLSource = @"document.getElementsByTagName('html')[0].innerHTML"; 
    NSString *HTMLSource = [webView_ stringByEvaluatingScriptFromString:jsToGetHTMLSource]; 
    NSLog(@"%@",HTMLSource);