jsdw_ios/QuickLocation/Section/Web/Controller/WebOperations.swift

30 lines
697 B
Swift

//
// CRMWebOperations.swift
// GXM-CRM
//
// Created by jsonmess on 2017/12/8.
// Copyright © 2017 DemoOrg. All rights reserved.
//
import Foundation
import UIKit
import WebKit
class WebOperations {
//
lazy var allowUrlRules: [String] = {
["http", "https"]
}()
// MARK: Web
///
func checkAndBlockInternalUrlScheme(request: URLRequest?) -> WKNavigationActionPolicy {
if let url = request?.url {
if let scheme = url.scheme, !allowUrlRules.contains(scheme) {
return .cancel
}
}
return .allow
}
}