我正在尝试加载一个 javascript 文件,但它不起作用。
我的代码:
NSString *html = [NSString stringWithFormat:@"<html><head></head><body><script type=\"text/javascript\" src=\"http://mywebsite.com/file.js\"></script></body></html>"];
[_webView loadHTMLString:html baseURL:nil];
此代码应该显示视频,但没有任何 react 。
此代码在桌面浏览器中正确显示视频,我的 JS 是正确的。
最佳答案
在 baseURL 中使用 url
NSURL *base=[NSURL URLWithString:@"website.com"];
关于ios - 无法在 UIWebView 中加载 javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29097470/