I've been trying to align my embedded YouTube video inside a UIWebView but the margin and padding just won't disappear.
I tried to get rid of it by using following code:
let padding = "document.body.style.margin='0';document.body.style.padding = '0'"
webView.stringByEvaluatingJavaScriptFromString(padding)
It's still not aligning correctly. I'm embedding the video using
let embededHTML = "<html><body><iframe src=\"http://www.youtube.com/embed/W7qWa52k-nE?playsinline=1\" width=\"\(width)\" height=\"\(height)\" frameborder=\"0\" allowfullscreen></iframe></body></html>"
webView.loadHTMLString(embededHTML, baseURL: NSBundle.mainBundle().bundleURL)
Can someone tell me what could be wrong? I'm pretty sure there is nothing wrong with the webView
positioning. This question contains answers to a similar issue but isn't that what I'm doing with JavaScript? If not, How do I add CSS to my HTML string?