I’m a noob to Cocoa programming, so please excuse the possible stupidity of this question.
I’m trying to build a web browser using Cocoa/MacRuby but am running into this strange rendering problem – a lot of sites render just fine, but all Google sites and a bunch of other sites (such as the CouchDB website) render with very small fonts.
I tried to mimic Firefox’s HTTP request and set headers like so:
def initialize_request(url)
url_request = NSMutableURLRequest.requestWithURL(NSURL.URLWithString(url))
url_request.setValue("ISO-8859-1,utf-8;q=0.7,*;q=0.7", forHTTPHeaderField:"Accept-Charset")
url_request.setValue("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", forHTTPHeaderField:"Accept")
url_request.setValue("en-us,en;q=0.5", forHTTPHeaderField:"Accept-Language")
url_request.setValue("gzip,deflate", forHTTPHeaderField:"Accept-Encoding")
url_request.setValue("keep-alive", forHTTPHeaderField:"Connection")
url_request.setValue("300", forHTTPHeaderField:"Keep-Alive")
headers = url_request.allHTTPHeaderFields
NSLog("All headers: #{headers.inspect}")
url_request
end
Full source file is here
Any pointers will be helpful, thanks in advance!
Check the font size in your app’s WebPreferences and the text-size multiplier on the WebView.