예제 #1
0
        /// <summary>
        /// Adds a url scheme to WWebview message interpreter.
        /// This scheme will be sent as a message to WWebView instead.
        /// </summary>
        /// <param name="scheme">
        /// The url scheme to add. It should not contain "://" part. 'wwebview' is added by default.
        /// </param>
        public void AddUrlScheme(string scheme)
        {
            Setup();

#if UNIWEBVIEW3_SUPPORTED
            UniWebViewInterface.AddUrlScheme(listener.Name, scheme);
#elif UNIWEBVIEW2_SUPPORTED
            UniWebViewPlugin.AddUrlScheme(listener.Name, scheme);
#else
            WWebViewPlugin.AddUrlScheme(listener.Name, scheme);
#endif
        }
예제 #2
0
    /// <summary>
    /// Adds a url scheme to UniWebView message system interpreter.
    /// All following url navigation to this scheme will be sent as a message to UniWebView instead.
    /// </summary>
    /// <param name="scheme">The url scheme to add. It should not contain "://" part. You could even add "http" and/or "https" to prevent all resource loading on the page. "uniwebview" is added by default. Nothing will happen if you try to add a dulplicated scheme.</param>
    public void AddUrlScheme(string scheme)
    {
        if (scheme == null)
        {
            UniWebViewLogger.Instance.Critical("The scheme should not be null.");
            return;
        }

        if (scheme.Contains("://"))
        {
            UniWebViewLogger.Instance.Critical("The scheme should not include invalid characters '://'");
            return;
        }
        UniWebViewInterface.AddUrlScheme(listener.Name, scheme);
    }