Skip to content

Instantly share code, notes, and snippets.

SAITO Tomomi saitomarch

Block or report user

Report or block saitomarch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@saitomarch
saitomarch / viewport_injection.swift
Created Jan 19, 2017
WKWebView JavaScript Injection to block zoom.
View viewport_injection.swift
// Remember to import WebKit at the top of the file
let source = "var meta = document.createElement('meta');" +
"meta.name = 'viewport';" +
"meta.content = 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no';" +
"var head = document.getElementsByTagName('head')[0];" +
"head.appendChild(meta);"
let userContentController = WKUserContentController()
userContentController.addUserScript(script)
You can’t perform that action at this time.