- (void)webViewDidFinishLoad:(UIWebView *)webView
{
// 取加载html文件的标题名
NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
}
$.ajax({
url: remoteur+'/api/innerMessageApi/noticeMessage.htm?callBackFunc=xx',
type: 'get',
dataType: 'jsonp',
jsonpCallback:"xx",
data: {msgId: msgId},
success: function(res){
console.log(res);
if ( res.successFlag == 'Y' ){
content = res.content;
title = res.title;
}
},
complete:function(res){
document.title = title;
$('body').append(content);
}
})
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)),
dispatch_get_main_queue(), ^{
self.title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
});
$.ajax({
url: remoteur+'/api/innerMessageApi/noticeMessage.htm?callBackFunc=xx',
type: 'get',
dataType: 'jsonp',
jsonpCallback:"xx",
data: {msgId: msgId},
// 设置同步操作
async: false,
success: function(res){
// 同步设置标题
document.title = res.title;
complete:function(res){
...
}
})
$.ajax({
url: remoteur+'/api/innerMessageApi/noticeMessage.htm?callBackFunc=xx',
type: 'get',
dataType: 'jsonp',
jsonpCallback:"xx",
data: {msgId: msgId},
// 设置同步操作
async: false,
success: function(res){
// 同步设置标题
document.title = res.title;
// js调用原生方法来设置标题
setWebViewTitle(title);
complete:function(res){
...
}
})
context[@"setWebViewTitle"] = ^(){
NSArray *args = [JSContext currentArguments];
if (args.count == 1) {
// 设置标题,只需要传递一个参数
self.title = [args firstObject];
}
};
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有