0

I am using WKWebView and the page I am trying to display is really big horizontally and the WKWebView is trying to fit everything into the view and it looks really zoomed out. Is there a way to make WKWebView scrollable and not zoomed out? It's scrollable vertically but not horizontally.

//Create a new Web View
webView = WKWebView()

//Assign the Web View Delegate to self
webView.navigationDelegate = self

//Define and populate the URL for the Web View
let url = URL (string: "http://www.example.com");

//Load the URL into the Web View
webView.load(URLRequest(url: url!))

//Assign the Web View as the View
view = webView

And here is the result

enter image description here

Any ways to fix this?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
user979331
  • 11,039
  • 73
  • 223
  • 418
  • Maybe [this](https://stackoverflow.com/questions/26295277/wkwebview-equivalent-for-uiwebviews-scalespagetofit) could help you. You can try it with something like `meta.setAttribute('content', 'width=theTotalWidthOfYourPageOrAnArbitraryBigNumber');`. – Ángel Téllez Nov 28 '18 at 16:33

1 Answers1

0

I was able to solve this by adding the following to my HTML:

<meta name="viewport" content="initial-scale=1.0" />
user979331
  • 11,039
  • 73
  • 223
  • 418