Esempio n. 1
0
    public static void SetUserAgent(string value)
    {
#if UNITY_IOS || UNITY_ANDROID || UNITY_EDITOR
        UniWebViewPlugin.SetUserAgent(value);
#endif
    }
Esempio n. 2
0
 /// <summary>
 /// Stop loading the current request. It will do nothing if the webpage is not loading.
 /// </summary>
 public void Stop()
 {
     UniWebViewPlugin.Stop(gameObject.name);
 }
Esempio n. 3
0
 /// <summary>
 /// Go to the previous page if there is any one.
 /// </summary>
 public void GoBack()
 {
     UniWebViewPlugin.GoBack(gameObject.name);
 }
Esempio n. 4
0
 /// <summary>
 /// Adds the URL scheme. After be added, all link of this scheme will send a message when clicked.
 /// </summary>
 /// <param name="scheme">Scheme.</param>
 /// <description>
 /// The scheme should not contain "://". For example, if you want to receive a url like "xyz://mydomian.com", you can pass "xyz" here.
 /// </description>
 public void AddUrlScheme(string scheme)
 {
     UniWebViewPlugin.AddUrlScheme(gameObject.name, scheme);
 }
Esempio n. 5
0
 /// <summary>
 /// Set the background of webview to transparent.
 /// </summary>
 /// <description>
 /// In iOS, there is a grey background in webview. If you don't want it, just call this method to set it transparent.
 /// There is no way to set Windows Phone 8 background to transparent, so this method will do noting on Windows Phone.
 /// </description>
 public void SetTransparentBackground(bool transparent = true)
 {
     UniWebViewPlugin.TransparentBackground(gameObject.name, transparent);
 }
Esempio n. 6
0
 /// <summary>
 /// Set the label text for the spinner showing when webview loading.
 /// The default value is "Loading..."
 /// </summary>
 /// <param name="text">Text.</param>
 /// <description>
 /// There is no text for Windows Phone spinner, so it will do noting for it.
 /// </description>
 public void SetSpinnerLabelText(string text)
 {
     UniWebViewPlugin.SetSpinnerText(gameObject.name, text);
 }
Esempio n. 7
0
 /// <summary>
 /// Determines whether this webview can go forward.
 /// </summary>
 /// <returns><c>true</c> if this instance can go forward, which means the user did at least once back;
 /// otherwise, <c>false</c>.</returns>
 public bool CanGoForward()
 {
     return(UniWebViewPlugin.CanGoForward(gameObject.name));
 }
Esempio n. 8
0
 /// <summary>
 /// Clean the cache of this UniWebView.
 /// </summary>
 public void CleanCache()
 {
     UniWebViewPlugin.CleanCache(gameObject.name);
 }
Esempio n. 9
0
 /// <summary>
 /// Set the background color of webview.
 /// </summary>
 /// <description>
 /// Set the background color of the webview. In iOS, it will only take in action when the web page has no background color from css.
 /// There is no way to set Windows Phone 8, so this method will do noting on Windows Phone.
 /// And in OSX Editor, it is limited and can be only used to set white or clear background.
 /// </description>
 public void SetBackgroundColor(Color color)
 {
     UniWebViewPlugin.SetBackgroundColor(gameObject.name, color.r, color.g, color.b, color.a);
 }
Esempio n. 10
0
 /// <summary>
 /// Determines whether the webview can go back.
 /// </summary>
 /// <returns><c>true</c> if this instance can go back, which means there is at least one page in the navigation stack below;
 /// otherwise, <c>false</c>.</returns>
 public bool CanGoBack()
 {
     return(UniWebViewPlugin.CanGoBack(gameObject.name));
 }
Esempio n. 11
0
 /// <summary>
 /// Set web content could be debug or not. Only works for Android.
 /// </summary>
 /// <description>
 /// You can enable Remote Debugging for Android devices by calling this method and passing true. See Google's
 /// Remote Debugging Android Devices documentation for more about it.
 /// https://developers.google.com/web/tools/chrome-devtools/debug/remote-debugging/remote-debugging
 ///
 /// This method will do nothing for iOS or editor.
 /// </description>
 /// <param name="enabled">Whether this page could be debug or not.</param>
 public static void SetWebContentsDebuggingEnabled(bool enabled)
 {
     #if UNITY_ANDROID && !UNITY_EDITOR
     UniWebViewPlugin.SetWebContentsDebuggingEnabled(enabled);
     #endif
 }
Esempio n. 12
0
 /// <summary>
 /// Set to load with overview mode or not.
 /// </summary>
 /// <param name="overview">
 /// If set to <c>true</c>, use overview mode to load the page.
 /// </param>
 /// <description>
 /// This method only works for Android. If you need to load your page with overview mode, you may
 /// want to enable it before you loading and showing your page.
 /// </description>
 public void LoadWithOverviewMode(bool overview)
 {
     #if UNITY_ANDROID && !UNITY_EDITOR
     UniWebViewPlugin.LoadWithOverviewMode(gameObject.name, overview);
     #endif
 }
Esempio n. 13
0
 /// <summary>
 /// Set the text in Done button of tool bar in iOS.
 /// User could use this button in iOS to close the web view. By default, "Done" will be shown for this button.
 /// If you want to change the text of tool bar done button for the webview, you have to call it before creating the UniWebView instance.
 /// This method only works for iOS. See <seealso cref="ShowToolBar"/>.
 /// </summary>
 /// <param name="text">The text you want to show for the Done button. Set it to null will reset it to "Done".</param>
 public static void SetDoneButtonText(string text)
 {
     #if UNITY_IOS && !UNITY_EDITOR
     UniWebViewPlugin.SetDoneButtonText(text);
     #endif
 }
Esempio n. 14
0
 /// <summary>
 /// Send a piece of javascript to the web page and evaluate (execute) it.
 /// </summary>
 /// <param name="javaScript">A single javascript method call to be sent to and executed in web page</param>
 /// <description>
 /// Although you can write complex javascript code and evaluate it at once, a suggest way is calling this method with a single js method name.
 /// The webview will try evaluate (execute) the javascript. When it finished, OnEvalJavaScriptFinished will be raised with the result.
 /// You can add your js function to the html page by referring to the js file in your html page, or add it by using AddJavaScript(string javaScript) method.
 /// </description>
 public void EvaluatingJavaScript(string javaScript)
 {
     UniWebViewPlugin.EvaluatingJavaScript(gameObject.name, javaScript);
 }
Esempio n. 15
0
 /// <summary>
 /// Add a url to white list of permission request trust sites.
 /// </summary>
 /// <description>
 /// This method only works in Android. In Android, if you request audio or video accessibility from web page,
 /// you should add the site url to a white list by using this method, or it will not be granted to use those protected resources.
 /// There is no need to call it in iOS, and this method will do nothing in platforms other than Android.
 /// For more about Android protected permission, see https://developer.android.com/reference/android/webkit/PermissionRequest.html.
 /// </description>
 /// <param name="url">URL.</param>
 public void AddPermissionRequestTrustSite(string url)
 {
     #if UNITY_ANDROID && !UNITY_EDITOR
     UniWebViewPlugin.AddPermissionRequestTrustSite(gameObject.name, url);
     #endif
 }
Esempio n. 16
0
 /// <summary>
 /// Add some javascript to the web page.
 /// </summary>
 /// <param name="javaScript">Some javascript code you want to add to the page.</param>
 /// <description>
 /// This method will execute the input javascript code without raising an
 /// OnEvalJavaScriptFinished event. You can use this method to add some customized js
 /// function to the web page, then use EvaluatingJavaScript(string javaScript) to execute it.
 /// This method will add js in a async way in Android, so you should call it earlier than EvaluatingJavaScript
 /// </description>
 public void AddJavaScript(string javaScript)
 {
     UniWebViewPlugin.AddJavaScript(gameObject.name, javaScript);
 }
Esempio n. 17
0
 /// <summary>
 /// Set user agent string for webview. This method has no effect on the webviews which are already initiated.
 /// The user agent of a UniWebView component can not be changed once it is created.
 /// If you want to change the user agent for the webview, you have to call it before creating the UniWebView instance.
 /// </summary>
 /// <param name="value">The value user agent should be. Set it to null will reset the user agent to the default one.</param>
 public static void SetUserAgent(string value)
 {
     UniWebViewPlugin.SetUserAgent(value);
 }
Esempio n. 18
0
 /// <summary>
 /// Clean the cookie using in the app.
 /// </summary>
 /// <param name="key">The key under which you want to clean the cache.</param>
 /// <description>
 /// Try to clean cookies under the specified key using in the app.
 /// If you leave the key as null or send an empty string as key, all cache will be cleared.
 /// This method will clear the cookies in memory and try to
 /// sync the change to disk. The memory opreation will return
 /// right away, but the disk operation is async and could take some time.
 /// Caution, in Android, there is no way to remove a specified cookie.
 /// So this method will call setCookie method with the key to set
 /// it to an empty value instead. Please refer to Android
 /// documentation on CookieManager for more information.
 /// The key parameter will be ignored at all on Windows Phone 8. All cookie will be cleared.
 /// </description>
 public void CleanCookie(string key = null)
 {
     UniWebViewPlugin.CleanCookie(gameObject.name, key);
 }
Esempio n. 19
0
 /// <summary>
 /// Reset the user agent of webview. This method has no effect on the webviews which are already initiated.
 /// The user agent of a UniWebView component can not be changed once it is created.
 /// If you want to set user agent, use the <see cref="SetUserAgent"/> method.
 /// </summary>
 public static void ResetUserAgent()
 {
     UniWebViewPlugin.SetUserAgent(null);
 }
Esempio n. 20
0
 /// <summary>
 /// Set if a default spinner should show when loading the webpage.
 /// </summary>
 /// <description>
 /// The default value is true, which means a spinner will show when the webview is on, and it is loading some thing.
 /// The spinner contains a label and you can set a message to it. <see cref=""/>
 /// You can set it false if you do not want a spinner show when loading.
 /// A progress bar will be used in Windows Phone instead of a spinner.
 /// </description>
 /// <param name="show">If set to <c>true</c> show.</param>
 public void SetShowSpinnerWhenLoading(bool show)
 {
     UniWebViewPlugin.SetSpinnerShowWhenLoading(gameObject.name, show);
 }
Esempio n. 21
0
    /// <summary>
    /// Load the url set in <seealso cref="url"/> property of this UniWebView.
    /// </summary>
    public void Load()
    {
        string loadUrl = String.IsNullOrEmpty(url) ? "about:blank" : url.Trim();

        UniWebViewPlugin.Load(gameObject.name, loadUrl);
    }
Esempio n. 22
0
 /// <summary>
 /// Set to use wide view port support or not.
 /// </summary>
 /// <param name="use">If set to <c>true</c> use view port tag in the html to determine the layout.</param>
 /// <description>
 /// This method only works (and be necessary) for Android. If you are using viewport tag in you page, you may
 /// want to enable it before you loading and showing your page.
 /// </description>
 public void SetUseWideViewPort(bool use)
 {
             #if UNITY_ANDROID && !UNITY_EDITOR
     UniWebViewPlugin.SetUseWideViewPort(gameObject.name, use);
             #endif
 }
Esempio n. 23
0
 /// <summary>
 /// Load a HTML string.
 /// </summary>
 /// <param name="htmlString">The content HTML string for the web page.</param>
 /// <param name="baseUrl">The base URL in which the webview should to refer other resources</param>
 /// <description>
 /// If you want to specify a local baseUrl, you need to encode it to proper format.
 /// See the "Can I load some html string by using UniWebView?" section in FAQ page (http://uniwebview.onevcat.com/faqs.html) for more.
 /// </description>
 public void LoadHTMLString(string htmlString, string baseUrl)
 {
     UniWebViewPlugin.LoadHTMLString(gameObject.name, htmlString, baseUrl);
 }
Esempio n. 24
0
 /// <summary>
 /// Go to the next page if there is any one.
 /// </summary>
 public void GoForward()
 {
     UniWebViewPlugin.GoForward(gameObject.name);
 }
Esempio n. 25
0
 /// <summary>
 /// Reload current page.
 /// </summary>
 public void Reload()
 {
     UniWebViewPlugin.Reload(gameObject.name);
 }
Esempio n. 26
0
 /// <summary>
 /// Removes the URL scheme. After be removed, this kind of url will be handled by the webview.
 /// </summary>
 /// <param name="scheme">Scheme.</param>
 public void RemoveUrlScheme(string scheme)
 {
     UniWebViewPlugin.RemoveUrlScheme(gameObject.name, scheme);
 }
Esempio n. 27
0
    public static void SetCookie(string url, string cookie)
    {
#if UNITY_IOS || UNITY_ANDROID || UNITY_EDITOR
        UniWebViewPlugin.SetCookie(url, cookie);
#endif
    }