Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ios
/
YH_Explorer
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
孙凯
7 years ago
Commit
e48d34146057d28fc48cfac313dc4b279306d706
1 parent
13a02269
add 用cordova.version判断cordova是否注入成功 review by daiqiang
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
YHExplorer/YHExplorerViewController.m
YHExplorer/YHExplorerViewController.m
View file @
e48d341
...
...
@@ -265,8 +265,18 @@ static float kprogressViewRadius = 2.0f;
-
(
BOOL
)
injectJavascript
:
(
NSString
*
)
resource
{
NSString
*
jsPath
=
[[
NSBundle
mainBundle
]
pathForResource
:
resource
ofType
:
@"js"
];
NSString
*
js
=
[
NSString
stringWithContentsOfFile
:
jsPath
encoding
:
NSUTF8StringEncoding
error
:
NULL
];
[
self
.
webView
stringByEvaluatingJavaScriptFromString
:
js
];
return
([
self
.
webView
stringByEvaluatingJavaScriptFromString
:
js
]
!=
nil
);
//用cordova.version判断cordova是否注入成功
NSString
*
jsCordovaVersion
=
[
NSString
stringWithFormat
:
@"cordova.version"
];
NSString
*
res
=
[
self
.
webView
stringByEvaluatingJavaScriptFromString
:
jsCordovaVersion
];
if
(
res
!=
nil
&&
res
.
length
>
0
)
{
return
TRUE
;
}
return
FALSE
;
}
/**
...
...
Please
register
or
login
to post a comment