Currently I can only figure out how to evaluate javascript by adding it to the webview's configuration's userContentController and reloading the page like so:
WKUserScript *script = [[WKUserScript alloc] initWithSource:source injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
[self.webView.configuration.userContentController addUserScript:script];
[self.webView reload];
How can I execute javascript on my WKWebView similarly to the old WebView's stringByEvaluatingJavaScriptFromString: so that I don't have to reload the page?
I'm trying to get something with the same effect as
[webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.querySelector('meta[name=viewport]').setAttribute('content', 'width=%d;', false); ", width]];