javascript - Programmatically resize / adjust dynamic html to fit UIWebView -


the requirement fit html uiwebview fixed size(s) i.e. predefined width x height combinations, these sizes specified developer. html, contains scripts further load other html(s) having dynamic elements, nature of not known @ runtime dynamic html(s) rich media ads (advertisements). have tried among several 100 solutions posted similar questions on so:

  1. changing meta viewport width & height of webview (https://developers.google.com/webmasters/mobile-sites/mobile-seo/responsive-design && http://webdesignerwall.com/tutorials/viewport-meta-tag-for-non-responsive-design)
  2. css update of canvas & div elements width/max-width & height/max-height of webview (based on testing showed these elements being main ones form html) through script tags (http://codetheory.in/scaling-your-html5-canvas-to-fit-different-viewports-or-resolutions/ , html content fit in uiwebview without zooming out)
  3. javascript injection update canvas & div elements.

the issue: regardless of above 3 changes applied or combination fails render html inside webview. either elements overflow or shrink , result display never 'correct'. leads me believe altogether not possible because

  • the layout of html elements cannot controlled based on sizes alone since work , altering them incorrectly not advised
  • the initial html load other html elements other divs , canvas' etc.
  • applying aforementioned approaches result in html being distorted divs , canvas' treated same way, regardless of width & height

i've not posted actual code of approaches tried above none have worked & think won't cater dynamic html(s). @ dead end , appreciate if confirm beliefs , validate them or point me towards solution. if such solution said not possible @ app level (in uiwebview), maybe convince html providers deliver size based htmls instead. appreciated.

- (void)webviewdidfinishload:(uiwebview *)webview {         cgrect newbounds = webview.bounds;         newbounds.size.height = webview.scrollview.contentsize.height;         webview.bounds = newbounds; } 

(nj)


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -