【发布时间】:2010-12-26 00:12:34
【问题描述】:
我想使用 stringByEvaluatingJavaScriptFromString 来运行一个 javascript,它引用设备上的本地文件(在本例中是 css 文件,但也可能是 js 文件)(我猜是在 Documents 文件夹中?)...
NSString *theJS = [[NSString alloc]
initWithString:@"javascript:(function()
{the_css.rel='stylesheet';
the_css.href='the_css.css';
the_css.type='text/css';
the_css.media='screen';}
)();"];
[webView stringByEvaluatingJavaScriptFromString:theJS];
我怎样才能让它发挥作用?如果我使用外部 css 文件,它可以正常工作,例如
the_css.href='http://www.website.com/the_css.css';
【问题讨论】:
标签: javascript iphone uiwebview stringbyevaluatingjavascr