I want to style a web page meant for the desktop so that it is presentable on a UIWebView on iPhone. I do not have access to the web server from which the pages originate. I
Your code should work, if you choose index 0 of the found elements:
NSString *js = @"document.getElementsByTagName('link')[0].setAttribute('href','";
NSString *js2 = [js stringByAppendingString:cssPath];
NSString *finalJS = [js2 stringByAppendingString:@"');"];
[webview stringByEvaluatingJavaScriptFromString:finalJS];
You missed [0]