I finally found another way: I load my html into a variable, and I replace some div with a “display: none” example:
let urlDeBase = "http://mywebsite/section/"
if let url = NSURL (string: urlDeBase){
var error: NSError?
let myHTML = String(contentsOfURL: url, encoding: NSUTF8StringEncoding, error: &error)
and I will replace what I want
let mystring = myHTML?.stringByReplacingOccurrencesOfString("<h3 class=\"myclass\">Menu</h3>", withString: "<h3 class=\"myclass\" style=\"display:none\">Menu</h3>")
webvieww.loadHTMLString(mystring, baseURL: nil)
source
share