Thursday, 15 September 2011

cocoa touch - iOS dev - referencing js files from settings root.plist -



cocoa touch - iOS dev - referencing js files from settings root.plist -

inside webviewcontroller.m file reference external js , css files used manipulate content pull webviewui.

i can reference external files using;

[webview stringbyevaluatingjavascriptfromstring: @"var script = document.createelement('script');" "script.type = 'text/javascript';" "script.src = 'http://xxx/xxx.js';" "document.getelementsbytagname('head')[0].appendchild(script);"];

but maintain having problems referencing file paths using settings root.plist;

nsstring *jsstr = @"var script = document.createelement('script');" "script.type = 'text/javascript';"; jsstr = [jsstr stringbyappendingstring:[defaults stringforkey:@"overridejspath" ]]; jsstr = [ jsstr stringbyappendingstring:@"document.getelementsbytagname('head')[0].appendchild(script);"]; [webview stringbyevaluatingjavascriptfromstring:jsstr];

i can reference css files using similar method, not js files. can help?

cocoa-touch

No comments:

Post a Comment