Categories

Events table

Event name Event description
event OnFinishedInit (WellWebView webview); Raised when the web view is fully initialized (Only then can methods be called, other than those that can only be called before initialization)
event OnPageStarted (WellWebView webview, string Url); Raised when the web view starts loading a url.
event OnPageFinished (WellWebView webview, string Url); Raised when the web view finished loading a url.
event OnReceivedData (WellWebView webview, WellReceivedData message); Raised when a message from web view is received.
event OnPageProgressLoad (WellWebView webview, int progress); Raised when the loading progress value changes in current web view.
event OnMultipleWindowOpened (WellWebView webview); Raised when a new window is created in the web view.
event OnMultipleWindowClosed (WellWebView webview); Raised when a new window is closed in the web view.
event OnReceivedError (WellWebView webview, string Url, int ErrorCode); Raised when an error occurs in the web view.
event OnDoneButtonClicked (WellWebView webview); Raised when you click on the Done button on the toolbar (IOS only).

Properties table

Properties name Properties description
bool FullScreen; Full-screen mode status parameter. When using the SetTargetRect() or setSize() method, it automatically becomes false. If the parameter is set to true, SetTargetRect() is ignored.
float Alpha; Parameter that returns the alpha channel of the web view.You can specify numbers in the range from 0.0 to 1.0

Methods table

Method name Method description
void SetTargetRect (RectTransform targetRect); Sets the target frame for the current web view. The web view will match the position and size of the target frame.
void Init (bool SwipeToRefresh); Initializing the web view.
void LoadUrl (string url); Loads a url in current web view.
void LoadHTMLString (string Html, string BaseUrl); Loads a HTML in current web view.
void Destroy (); Destroying the current web view.
void StopLoading (); Stop loading the current page.
void Reload (); Reloading the current page.
string GetUrl (); Return the url of the loaded page in the current web view.
void Show (bool fade, float duration, AnimationType animation, Action <ResultCallback> Callback); Sets visible the current web view.
void Hide (bool fade, float duration, AnimationType animation, Action <ResultCallback> Callback); Sets invisible the current web view.
void EvaluateJavaScript (string jsCode, Action <ResultCallback> Callback); Evaluate JavaScript in current page.
void AddJavaScript (string jsCode, Action <ResultCallback> Callback); Adds JavaScript in current page.
void GetHTMLCode (bool unescape, Action <ResultCallback> Callback); Get the html code loaded in the current webview.
void SetSize (int x, int y, int width, int height); Sets the size and position of the current web view.
void ScrollTo (int x, int y, bool animate); Scroll to the specified coordinates in the current web view.
int GetMaxScrolledPage (); Return the page height in the current web view.
bool IsInitialized (); Returns whether the web view is initialized.
void AddUrlCustomScheme (string scheme); Adding a schema to manually process it in OnReceivedData.
void RemoveUrlCustomScheme (string scheme); Remove the schema for manual processing.
void SetUserAgent (string UserAgent); Sets the user agent in the current web view.
string GetUserAgent (); Return the user agent from the current web view.
void Print (); Print the loaded page in the current web view.
void ShowProgressBar (string HexColor); Show the progress bar while loading pages.
void HideProgressBar (); Hide the progress bar.
static void SetAllowAutoPlay (bool AutoPlay); Allow autoplay media playback in the current web view (call before initializing the web view, otherwise the option will not work).
static void SetAllowJavaScript (bool EnableJavaScript); Allow JavaScript in the web view (call before initializing the web view, otherwise the option will not work).
void SetZoomEnabled (bool EnableZoom); Allow zoom content in the current web view.
void SetHorizontalScrollBarEnabled ( bool Enable); Enabling the horizontal scroll bar in the current web view.
void SetVerticalScrollBarEnabled (bool Enable); Enabling the vertical scroll bar in the current web view.
void SetAllowContextMenu (bool Enable); Allow the context menu in the current web view.
void SetUserInteraction (bool Interaction); User interaction with the current web view.
void SetSupportMultipleWindows (bool support); Enable support for multiple windows in the current web view.
static void SetJavaScriptCanOpenWindowsAutomatically (bool Enable); Allow windows to open automatically (call before initializing the web view, otherwise the option will not work).
bool CanGoBack (); Returns whether it is possible to return to the previous page.
bool CanGoForward (); Returns whether it is possible to return to the forward page.
void GoBack (); Go back to the previous page in the current web view.
void GoForward (); Go forward page in the current web view.
void AllowShowSslDialog (bool Allow); Allow to show the ssl error dialog box,to prohibit or allow page loading (Android only).
void UpdateCookie (); Force call to save cookies.
void ClearCookies (); Clears all cookies from web view.
void AddCookie (string url, string Cookies); Adding a cookie to the current web view.
string GetCookie (string url, string Key); Returns the value of the cookie under the URL and key.
void ShowSpinner (bool Enable); Show the loading spinner while loading pages.
void SetSpinnerText (string text); Add text to loading spinner.
void AddHTTPHeader (string key, string value); Adding custom headers to queries in the current web view.
void RemoveHTTPHeader (string key); Removing custom request headers in the current web view.

Methods for Android only

Method name Method description
void SetLoadWithOverviewMode (bool overview); Sets whether the WebView loads pages in the browse mode, that is, reduces the content scale to the screen width.
void SetUseWideViewPort (bool use); Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport.
void SetDefaultFontSize (int spanSize); Sets the default span size in the current web view.
void ShowNavigationBar (bool show); Adding a navigation bar (do not enable full-screen).

Methods for IOS only

Method name Method description
void AllowBackForwardNavigationGestures (bool allow); Allow support horizontal swipe gestures trigger backward and forward page navigation.
void ShowToolBar (bool OnTop, bool Animate, bool AdjustInset); Show the toolbar, with the back and forward buttons located on it, and a button with the ability to get a return response in Ondonebuttoncliked.
void HideToolBar (bool Animate); Hide the toolbar.
void SetBackButtonText (string Title); Sets the text for the Back button in the toolbar.
void SetForwardButtonText (string Title); Sets the text for the Forward button in the toolbar.
void SetDoneButtonText (string Title); Sets the text for the Done button in the toolbar.
void SetToolbarTextSize (int TextSize); Sets the size of the button text in the toolbar.
void AddDownloadMimeType (string MimeType, string FileExtension); Adds the MIME type to the download files checklist.
void RemoveDownloadMimeType (string MimeType); Remove the MIME type in the download files checklist.
void SetToolbarTintColor (string HexColor); Sets the toolbar color.
void SetToolbarTextColor (string HexColor); Sets the toolbar text color.

Events

event OnFinishedInit (WellWebView webview)

An event that is raised when the initialization of the web view is completed. After this event, you can call the web view methods (except those that are called before creating the web view).

Parameters:

WellWebView webview

The web view that raised the event.

Example:

webView.OnFinishedInit += (RaisedWebView) => //in this case, webView == RaisedWebView
{
// The web view is fully initialized, and you can call the web view methods
webView.LoadUrl("https://example.com");
};

event OnPageStarted (WellWebView webview, string Url)

An event that raised when a page starts loading in the web view.

Parameters:

WellWebView webview

The web view that raised the event.

string Url

The url that is being loaded.

Example:

webView.OnPageStarted += (RaisedWebView, Url) => //in this case, webView == RaisedWebView
{
print(Url);
// => "https://example.com"
};

webView.LoadUrl("https://example.com");

event OnPageFinished (WellWebView webview, string Url)

Event that raised when a page is finished loading in the web view.

Parameters:

WellWebView webview

The web view that raised the event.

string Url

The url that completed loading.

Example:

webView.OnPageFinished += (RaisedWebView, Url) => //in this case, webView == RaisedWebView
{
print(Url);
// => "https://example.com"
};

webView.LoadUrl("https://example.com");

event OnReceivedData (WellWebView webview, WellReceivedData message)

It is raised when the web view receives a custom schema added for manual processing, takes all the parameters of the string passed to it, and returns it to Unity.

Parameters:

WellWebView webview

The web view that raised the event.

WellReceivedData message

A message that contains information such as host, scheme.

Example:

webView.OnReceivedData += (RaisedWebView, Message) => //in this case, webView == RaisedWebView
{
print("RawData:" + Message.RawData);
print("Scheme: " + Message.Scheme);
print("Host: " + Message.Host);
List <string> ArgsName = Message.Args.GetValues("name");
if (ArgsName.Count > 0)
{
foreach(string name in ArgsName){
print("name: " + name);
}
}
};

// There is no need to add the 'wellwebview' schema , it is added by default
webView.LoadUrl("wellwebview://host?name=Alex&age=25");
// => "RawData: wellwebview://host?name=Alex&age=25"
// => "Scheme: wellwebview"
// => "Host: host"
// => "Scheme: wellwebview"
// => "name: Alex"

webView.AddUrlCustomScheme("testScheme");
webView.LoadUrl("testScheme://host?name=Alex&age=25&name=Elena");
// => "RawData: testScheme://host?name=Alex&age=25&name=Elena"
// => "Scheme: testScheme"
// => "Host: host"
// => "Scheme: testScheme"
// => "name: Alex"
// => "name: Elena"

event OnPageProgressLoad (WellWebView webview, int progress)

The event is raised when the page loads, and displays the page loading progress from 0 to 100 in the current web view.

Parameters:

WellWebView webview

The web view that raised the event.

int progress

Progress loading pages.

Example:

webView.OnPageProgressLoad += (RaisedWebView, progress) => //in this case, webView == RaisedWebView
{
print(progress);
// => progress from 0 to 100, some values may be skipped.
};

webView.LoadUrl("https://example.com");

event OnMultipleWindowOpened (WellWebView webview)

The event is raised when a new window opens in the web view. This event is only registered if multiple windows are supported.

Parameters:

WellWebView webview

The web view that raised the event.

Example:

webView.OnMultipleWindowOpened += (RaisedWebView) => //in this case, webView == RaisedWebView
{
// Executing some Scode
};

event OnMultipleWindowClosed (WellWebView webview)

The event is raised when a new window closed in the web view. This event is only registered if multiple windows are supported.

Parameters:

WellWebView webview

The web view that raised the event.

Example:

webView.OnMultipleWindowClosed += (RaisedWebView) => //in this case, webView == RaisedWebView
{
// Executing some code
};

event OnReceivedError (WellWebView webview, string Url, int ErrorCode)

The event is raised when an error raised when loading a page or the web view itself.

Parameters:

WellWebView webview

The web view that raised the event.

string Url

The URL that caused the error.

int ErrorCode

Error code.

Example:

webView.OnReceivedError += (RaisedWebView, url, errorCode) => //in this case, webView == RaisedWebView
{
print("Error url: " + url);
print("Error code: " + errorCode);
};

webView.LoadUrl("https://example-with-error404.com");
// => "Error url: https://example-with-error404.com"
// => "Error code: 404"

IOS-Icon

event OnDoneButtonClicked (WellWebView webview)

Event that raised when you click the Done button on the toolbar (IOS only).

Parameters:

WellWebView webview

The web view that raised the event.

Example:

webView.OnDoneButtonClicked += (RaisedWebView) => //in this case, webView == RaisedWebView
{
// Executing some code
};

Methods

void Init (bool SwipeToRefresh)

Initializing the web view. Important:The SwipeToRefresh parameter only works on Android.

Parameters:

bool SwipeToRefresh

Enables the ability to reload by swiping across the top of the site in the current web view (Only Android). Default value: false

Example:

// Initializing the web view.
webView.Init();

void SetTargetRect (RectTransform targetRect)

Sets the target frame for the current web view. The web view will match the position and size of the target frame. Important:This disables FullScreen mode.

Parameters:

RectTransform targetRect

Sets the target frame.

Example:

// Sets the target frame for the current web view.
webView.SetTargetRect(targetRect);

void LoadUrl (string url)

Loads a url in current web view.

Parameters:

string url

The url to be loaded. This url should start with http:// or https:// scheme.
If the site is local (stored in StreamingAssets Folder in Unity). Use the GetStreamingAssetURL() method to convert the path to the correct url

Example:

// Load a URL.(This URL starts with http:// or https://)
webView.LoadUrl("https://example.com");

// Load a local URL.(This URL stored in StreamingAssets Folder in Unity).
//If the file is stored in the path "StreamingAssets/sites/site_1.html" then you only need to write "sites/site_1.html"

webView.LoadUrl(WellWebView.GetStreamingAssetURL("sites/site_1.html"));

void LoadHTMLString (string Html, string BaseUrl)

Loads a HTML code in current web view.

Parameters:

string Html

Html to be used as the page content

string BaseUrl

The url to use as the page's base url

Example:

// Loads a HTML code.
webView.LoadHTMLString("<html><body>You scored <b>192</b> points.</body></html>","https://example.com");

void Destroy()

Destroying the current web view.

Example:

webView.Destroy();

void StopLoading()

Stop loading the current page in the current web view.

Example:

// Stop loading the current page
webView.StopLoading();

void Reload()

Reloading the current page in the current web view.

Example:

// Reloading the current page
webView.Reload();

void GetUrl()

Get the currently loaded URL.

Example:

// Get loaded url in current web view
webView.LoadUrl("https://example.com");

//after waiting for the page to load, or after getting "OnPageFinished"
string Url = webView.GetUrl();
print(Url);
// => "https://example.com"

void Show (bool fade, float duration, AnimationType animation, Action <ResultCallback> Callback)

Sets the web view that is visible on the screen.
If the parameter fade == false and animation == None, then the parameter "duration" will not be taken into account, since there will be no animation. Regardless of whether there was an animation or not, the Callback will be called at the very end method.

Parameters:

bool fade

Show with fade-in animation. Default value: false

float duration

Animation duration. Default value: 0f

AnimationType animation

Selecting the animation type. Default value: None

Action <ResultCallback> Callback

Callback at the end of the animation. Default value: null

Example:

// Show web view without Animation
webView.Show();

// Show a web view with a fade animation
webView.Show(true);

// Show the web view with a modal presenting animation from screen up on duration 5 seconds with Callback
webView.Show(true, 5f, AnimationType.Slide_Up,(result) => {
print("web view animation is finished!");
});

// Show the web view with a modal presenting animation from screen up on duration 5 seconds without Callback
webView.Show(true, 5f, AnimationType.Slide_Up);

void Hide (bool fade, float duration, AnimationType animation, Action <ResultCallback> Callback)

Sets the web view that is invisible on the screen.
If the parameter fade == false and animation == None, then the parameter "duration" will not be taken into account, since there will be no animation. Regardless of whether there was an animation or not, the Callback will be called at the very end method.

Parameters:

bool fade

Hide with fade-in animation. Default value: false

float duration

Animation duration. Default value: 0f

AnimationType animation

Selecting the animation type. Default value: None

Action <ResultCallback> Callback

Callback at the end of the animation. Default value: null

Example:

// Hide web view without Animation
webView.Hide();

// Hide a web view with a fade animation
webView.Hide(true);

// Hide the web view with a modal presenting animation from screen up on duration 5 seconds with Callback
webView.Hide(true, 5f, AnimationType.Slide_Up,(result) => {
print("web view animation is finished!");
});

// Hide the web view with a modal presenting animation from screen up on duration 5 seconds without Callback
webView.Hide(true, 5f, AnimationType.Slide_Up);

void EvaluateJavaScript (string jsCode, Action <ResultCallback> Callback)

Evaluate JavaScript on the current page. The current method adds JavaScript code to the page and executes the specified code.Important: JavaScript must be enabled, otherwise the method will not work

Parameters:

string jsCode

The javascript string.

Action <ResultCallback> Callback

The callback is called when the JavaScript operation completes .The result is in "ResultCallback.result" in string. Default value: null

Example:

// Executing JavaScript code on the current page. Changes the background color of the page to #212121.(Option without returning a value, in the current case ResultCallback.result == "")

webView.EvaluateJavaScript("document.body.style.backgroundColor = '#212121';");

// Executing JavaScript code on the current page. Adds and calls the function "function" which returns the value "this".(in the current case ResultCallback.result == "this")

webView.EvaluateJavaScript("(function() { return 'this'; })();", (result) => {
print(result.Result);
// => "this"
});

void AddJavaScript (string jsCode, Action <ResultCallback> Callback)

Adds JavaScript on the current page. The current method adds JavaScript code to the page and executes the specified code.Important: JavaScript must be enabled, otherwise the method will not work

Parameters:

string jsCode

The javascript string.

Action <ResultCallback> Callback

The callback is called when the JavaScript operation completes .The result is in "ResultCallback.result" in string. Default value: null

Example:

// Executing JavaScript code on the current page. Changes the background color of the page to #212121.(Option without returning a value, in the current case ResultCallback.result == "")

webView.AddJavaScript("document.body.style.backgroundColor = '#212121';");

// Executing JavaScript code on the current page. Adds and calls the function "function" which returns the value "this".(in the current case ResultCallback.result == "this")

webView.AddJavaScript("(function() { return 'this'; })();", (result) => {
print(result.Result);
// => "this"
});

void GetHTMLCode (bool unescape, Action <ResultCallback> Callback)

Get the html code loaded into the current webview.Important: JavaScript must be enabled, otherwise the method will not work

Parameters:

bool unescape

Do I need to replace escape unicode characters with ascii or delete them if conversion is not possible (Example: "\u0442" is converted to "T")

Action <ResultCallback> Callback

Returns the loaded HTML code in the current web view.The result is in "ResultCallback.result" in string.

Example:

/*Loading an HTML page with HTML code:
<!DOCTYPE html>
<html>
<body>
<h1>My test site for testing the GetHtml method</h1>
<p>At this point,the text starting with the paragraph is located</p>
</body>
</html>
*/


webView.LoadUrl("https://example.com");
//after waiting for the page to load, or after getting "OnPageFinished"

// Getting the loaded HTML code in the current web view without unescape-unicode character formatting.
webView.GetHTMLCode(false,(result) => {
print(result.Result);
// => "\u003Cbody>\n\u003Ch1>My test site for testing the GetHtml method\u003C/h1>\n\u003Cp>At this point,the text starting with the paragraph is located\u003C/p>\n\n\u003C/body>"
});

// Getting the loaded HTML code in the current web view with unescape-unicode character formatting.
webView.GetHTMLCode(true,(result) => {
print(result.Result);
// => "<body>\n<h1>My test site for testing the GetHtml method</h1>\n<p>At this point,the text starting with the paragraph is located</p>\n\n</body>"
});

void SetSize (int x, int y, int width, int height)

Sets the size and position of the current web view. Important: When calling this method, sets fullscreen == false and TargetFrame == null for the current web view. (After that, you need to manually handle the device orientation changes).

Parameters:

int x

Position by X

int y

Position by Y

int width

Width of the current web view

int height

Height of the current web view

Example:

// Set the size {1080x1920} and position {0,0} for the current web view
webView.SetSize(0,0,1080,1920);

void ScrollTo (int x, int y, bool animate)

Scroll to the specified coordinates in the current web view.

Parameters:

int x

Position by X

int y

Position by Y

bool animate

Smooth scrolling to the specified coordinates. Default value: false

Example:

// scroll the page to the coordinates {0,500} without scrolling animation
webView.ScrollTo(0,500);

// scroll the page to the coordinates {0,500} with scrolling animation
webView.ScrollTo(0,500,true);

int GetMaxScrolledPage()

Getting the page height with content in the current web view.

Example:

webView.LoadUrl("https://example.com");
//after waiting for the page to load, or after getting "OnPageFinished"

// Getting the page height
int HeightPage = webView.GetMaxScrolledPage();
print(HeightPage);
// => 500

bool IsInitialized()

Is the webview initialized.

void AddUrlCustomScheme (string scheme)

Adding a schema to manually process it in OnReceivedData in the current web webView.Scheme "wellwebview" is added by default.

Parameters:

string scheme

scheme without ://

Example:

//Add a schema "customscheme" for manual processing in OnReceivedData
webView.AddUrlCustomScheme("customscheme");

// a link like "customscheme://action_link" will be treated as a message in "OnReceivedData" and will not be processed by the current web view from that point on

void RemoveUrlCustomScheme (string scheme)

Remove the schema for manual process it in OnReceivedData in the current web webView.

Parameters:

string scheme

scheme without ://

Example:

//Remove a schema "customscheme" for manual processing in OnReceivedData
webView.RemoveUrlCustomScheme("customscheme");

void SetUserAgent (string UserAgent)

Sets the user agent in the current web view.

Parameters:

string UserAgent

new user agent in current web view

Example:

//installing the user agent in the current web view from Chrome user agent string on a Galaxy Nexus.
webView.SetUserAgent("Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19");

// in the request header:
User Agent => "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19"

string GetUserAgent()

Getting the user agent in the current web view.

Example:

//Get the default user agent in the current web view.
webView.GetUserAgent(); // => "Mozilla/5.0 (Linux; Android 10; POCOPHONE F1 Build/QKQ1.190828.002;) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/85.0.4183.101 Mobile Safari/537.36"

webView.SetUserAgent("Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19");

webView.GetUserAgent(); User Agent => "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19"

void Print()

Print the loaded page in the current web view.

Example:

//Print the content of the loaded page in the current web view.
webView.Print();

void ShowProgressBar (string HexColor)

Show the progress bar while loading pages.

Parameters:

string HexColor

Progress fill color in Hex-color. Default value: #87cefa

Example:

// Show the progress bar while loading pages and set color fill progress "#ff9966"
webView.ShowProgressBar("#ff9966");

void HideProgressBar()

Hide the progress bar.

Example:

// Hide the progress bar.
webView.HideProgressBar();

static void SetAllowAutoPlay (bool AutoPlay)

Allow autoplay media playback in web views that you create.The default value is:false. Important:called before initializing the web view, otherwise the method will not work on already created web views.

Parameters:

bool AutoPlay

Autoplay media playback.

Example:

webView.LoadUrl("https://example.com");
// Set autoplay media playback in the current web view
WellWebView.SetAllowAutoPlay(true);
// The web view will not autoplay the media playback. The method will only work with the following created web views.


// The correct call steps to this method for auto playing media.
WellWebView.SetAllowAutoPlay(true);
WellWebView WebView = WellWebView.CreateWebView();
WebView.Init();
WebView.OnFinishedInit += (webView) => {
webView.LoadUrl("https://example.com");
//The current web view will automatically play the media.
};

static void SetAllowJavaScript (bool EnableJavaScript)

Allow JavaScript in web views that you create.The default value is:false. Important:called before initializing the web view, otherwise the method will not work on already created web views.

Parameters:

bool EnableJavaScript

Allow JavaScript execution.

Example:

// Executing JavaScript code on the current page.
webView.EvaluateJavaScript("document.body.style.backgroundColor = '#212121';");
// this JavaScript code will not be executed. since Javascript is not enabled in the web view (the method will not be called and there will not be any callback)


// The correct call steps to this method for execute Javascript.
WellWebView.SetAllowJavaScript(true);
WellWebView WebView = WellWebView.CreateWebView();
WebView.Init();
WebView.OnFinishedInit += (webView) => {
webView.EvaluateJavaScript("document.body.style.backgroundColor = '#212121';");
// => Successful JavaScript code executed.
};

WebView.EvaluateJavaScript("(function(){ return 'this'; })();", (result) =>
{// => Successful JavaScript code executed.
print(result.Result);
// => "this"
});

void SetZoomEnabled (bool EnableZoom)

Allow zoom content in the current web view.The default value is: false

Parameters:

bool EnableZoom

Allow zoom content.

Example:

// Enable zoom content in the current web view.
webView.SetZoomEnabled(true);

void SetHorizontalScrollBarEnabled (bool Enable)

Enabling the horizontal scroll bar in the current web view.The default value is: false

Parameters:

bool Enable

Enabling the horizontal scroll bar.

Example:

// Enable the horizontal scroll bar in the current web view.
webView.SetHorizontalScrollBarEnabled(true);

void SetVerticalScrollBarEnabled (bool Enable)

Enabling the vertical scroll bar in the current web view.The default value is: false

Parameters:

bool Enable

Enabling the vertical scroll bar.

Example:

// Enable the vertical scroll bar in the current web view.
webView.SetVerticalScrollBarEnabled(true);

void SetAllowContextMenu (bool Enable)

Allow the context menu in the current web view.Example: "copy", "select all", etc. The default value is: true

Parameters:

bool Enable

Enabling the context menu.

Example:

// Disable the context menu in the current web view.
webView.SetAllowContextMenu(false);

void SetUserInteraction (bool Interaction)

User interaction with the current web view. The default value is: true

Parameters:

bool Interaction

User interaction.

Example:

// Disable user interaction with the current web view.
webView.SetUserInteraction(false);

void SetSupportMultipleWindows (bool support)

Sets whether the web view should support pop-up web views launched by the user on a new tab.In browsers (such as Google Chrome, Safari, etc.), these tabs open on new pages. But in the context of a web view, it is not possible to manage different tabs.So by default, the web view tries to load this link in the current web view. But there are sites that can not properly handle this option and for them it is acceptable only to open a new window(Enable support multiple windows) (we will open a new instance of the web view that repeats the size of the original web view on top of it, and when you close the tab, this instance will be deleted and the user will return to the original web view). The default value is: false

Parameters:

bool support

Support for multiple windows.

Example:

// Enable support multiple windows in the current web view.
webView.SetSupportMultipleWindows(true);

static void SetJavaScriptCanOpenWindowsAutomatically (bool Enable)

Tells JavaScript to open windows automatically. This applies to the JavaScript function window.open().The default value is: false. Important:Must be enabled support multiple windows. Called before initializing the web view, otherwise the method will not work on already created web views.

Parameters:

bool Enable

Tells JavaScript to open windows automatically.

Example:

// Tell JavaScript to open a new window with the link being passed.
webView.EvaluateJavaScript("window.open("https://example.com");");
// The transmitted link will be loaded in the current web view


// Correct steps for handling the JavaScript method: windows.open(); in new tabs.
WellWebView.SetJavaScriptCanOpenWindowsAutomatically(true);
WellWebView WebView = WellWebView.CreateWebView();
WebView.Init();
WebView.OnFinishedInit += (webView) =>
{
webView.SetSupportMultipleWindows(true);
webView.EvaluateJavaScript("window.open("https://example.com");"); // => New web view opened on top of the current web view.
};

bool CanGoBack()

Is it possible to go back to the previous page in the current web view.

bool CanGoForward()

Is it possible to return to the forward page in the current web view.

void GoBack()

Go back to the previous page in the current web view.

Example:

// Go back to the previous page in the current web view.
webView.GoBack();

void GoForward()

Go forward page in the current web view.

Example:

// Go forward page in the current web view.
webView.GoForward();

Android-Icon

void AllowShowSslDialog(bool Allow)

Allow to show the ssl error dialog box to prohibit or allow page loading (Android only). The default value is: false

Parameters:

bool Allow

Allow to show the ssl error dialog box.

Example:

// Allow to show the ssl error dialog box in the current web view.
webView.AllowShowSslDialog(true);

void UpdateCookie()

Force call to save cookies in the current web view.The web view automatically adjusts the saving of cookies, but to trigger the saving manually, you can use this method.

Example:

// Force call to save cookies in the current web view.
webView.UpdateCookie();

void ClearCookies()

Clears all cookies from web view.

Example:

// Clears all cookies from web view.
webView.ClearCookies();

void AddCookie(string url,string Cookies)

Sets a cookie for a specific address. By default, the web view uses server-side cookies. However, if you need to manually pass a cookie, use this method.

Parameters:

string url

The URL for which the cookie will be set

string Cookies

The cookie string to set

Example:

// Setting some value in the cookie for example.com
webView.AddCookie("https://example.com ","name=23frfjkiji;");

// Setting full properties in the cookie for example.com
webView.AddCookie("https://example.com ","version=2; name=Test; value=1234;expiresDate=Wed, 30-Nov-2001 01:01:01 GMT; domain=example.com;");

string GetCookie(string url,string Key)

Returns the value of the cookie by url and key.

Parameters:

string url

The URL where the cookie is located

string Key

Key for finding the value in the cookie

Example:

// Get the cookie value in "example.com" by the "TestKey" key
webView.GetCookie("example.com","TestKey");
// =>Getting cookie value. Else if cookie key no found return ""

void ShowSpinner(bool Enable)

Show the loading spinner while loading pages in the current web view. The default value is: false

Parameters:

bool Enable

Show the loading spinner.

Example:

// Show the loading spinner.
webView.ShowSpinner(true);

void SetSpinnerText(string text)

Sets text for the loading spinner in the current web view.

Parameters:

string text

text for the loading spinner.

Example:

// Sets text for the loading spinner.
webView.SetSpinnerText("LoadingText");

void AddHTTPHeader(string key, string value)

Sets a custom header field for requests to the current web view.The header field will be added to each subsequent request. Not all default headers can be overridden.(for example, such as user-agent, it can be overridden by the appropriate method).Important:Сustom header field, can only be set for GET requests. Header fields will not be added to POST requests due to WebKit restrictions on Android and iOS platforms.

Parameters:

string key

Header key

string value

Header valuey

Example:

// Set "CustomToken" field to "123abc" in the current web view. It will be used for all following requests.
webView.AddHTTPHeader("CustomToken","123abc");

void RemoveHTTPHeader(string key)

Remove a custom header field for to the current web view.

Parameters:

string key

Header key

Example:

// Remove "CustomToken" request in the current web view.
webView.RemoveHTTPHeader("CustomToken");

iOS-Icon

static void AllowInlinePlay(bool allow)

Sets how HTML5 videos will be played inline or using the built-in fullscreen controller (IOS only).The default value is: false (videos play using the built-in fullscreen controller). Important:Called before initializing the web view, otherwise the method will not work on already created web views.

Parameters:

bool allow

Allow Inline Play.

Example:

WellWebView.AllowInlinePlay(true);
WellWebView WebView = WellWebView.CreateWebView();
WebView.Init();

Android-Icon

void SetLoadWithOverviewMode(bool overview)

Sets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on screen by width. This setting is taken into account when the content width is greater than the width of the WebView control, for example, when SetUseWideViewPort() is enabled (Android only). The default value is: false

Parameters:

bool overview

overview

Example:

// Set whether the WebView loads pages in overview mode.
WebView.Android.SetLoadWithOverviewMode(true);

Android-Icon

void SetUseWideViewPort(bool use)

Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is false, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is true and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used (Android only). The default value is: false

Parameters:

bool use

Enable support for the "viewport" HTML meta tag

Example:

// Set support for the "viewport" HTML meta tag in current web view.
WebView.Android.SetUseWideViewPort(true);

Android-Icon

void SetDefaultFontSize(int fontSize)

Sets the default font size in current web view (Android only). The default value is: 16

Parameters:

int fontSize

a non-negative integer between 1 and 72. Any number outside the specified range will be pinned.

Example:

// Set Default Font Size in current web view.
WebView.Android.SetDefaultFontSize(24);

Android-Icon

void ShowNavigationBar(bool show)

Unity for Android , sets the default fullscreen theme, which does not provide for the display of the navigation bar.But if you need a navigation bar, then use this method (Android only). The default value is: false Important:Activating the navigation bar without specifying the appropriate theme in the manifest may work unpredictably on some devices.

Parameters:

bool show

Is the navigation bar shown

Example:

// Set show navigation bar in current web view.
WebView.Android.ShowNavigationBar(true);

IOS-Icon

void AllowBackForwardNavigationGestures(bool allow)

Sets whether horizontal swipe gestures trigger backward and forward page navigation in the current web view (IOS only). The default value is: false

Parameters:

bool allow

Allow navigation gestures

Example:

// Allow navigation gestures in current web view.
WebView.IOS.AllowBackForwardNavigationGestures(true);

IOS-Icon

void ShowToolBar(bool OnTop, bool Animate, bool AdjustInset)

Sets the toolbar display in the current web view. You can select the position of the toolbar at the bottom or top of the screen. Show with animation or not. So should there be an offset of the web view to show the toolbar, or will it overlap some of the content of the web view. There are 3 buttons on the toolbar, 2 buttons on the left are: back and forward buttons, on the right is the Done button (you can get the Ondonebuttoncliked callback in Unity by clicking on it).Their text can also be changed using the appropriate methods: SetBackButtonText(), SetForwardButtonText(), SetDoneButtonText() (IOS Only).

Parameters:

bool OnTop

The position of the toolbar. Default value: true

bool Animate

Animated show. Default value: false

bool AdjustInset

Slide the web view from the top to avoid overlapping the web view. Default value: false

Example:

// Show toolbar in top position in current web view.
WebView.IOS.ShowToolBar(true,true,true);

IOS-Icon

void HideToolBar(bool Animate)

Hide the toolbar in the current web view (IOS only).

Parameters:

bool Animate

Hide smooth. Default value: false

Example:

// Hide the toolbar in current web view.
WebView.IOS.HideToolBar(true);

IOS-Icon

void SetBackButtonText(string Title)

Sets the text for the Back button in the toolbar in the current web view (IOS only).

Parameters:

string Title

Text for the Back button.

Example:

// Set "Back" text for back button in toolbar in current web view.
WebView.IOS.SetBackButtonText("Back");

IOS-Icon

void SetForwardButtonText(string Title)

Sets the text for the Forward button in the toolbar in the current web view (IOS only).

Parameters:

string Title

Text for the Forward button.

Example:

// Set "Forward" text for forward button in toolbar in current web view.
WebView.IOS.SetForwardButtonText("Forward");

IOS-Icon

void SetDoneButtonText(string Title)

Sets the text for the Done button in the toolbar in the current web view (IOS only).

Parameters:

string Title

Text for the Done button.

Example:

// Set "Done" text for done button in toolbar in current web view.
WebView.IOS.SetDoneButtonText("Done");

IOS-Icon

void SetToolbarTextSize(int TextSize)

Sets the size of the button text in the toolbar (IOS only).

Parameters:

int TextSize

Text size.

Example:

// Set text size for buttons in toolbar.
WebView.IOS.SetToolbarTextSize(24);

IOS-Icon

void AddDownloadMimeType(string MimeType, string FileExtension)

Adds the MIME type to the download files checklist.Only the added mimetypes will be checked for download capability. (IOS only).

Parameters:

string MimeType

MIME type.

string FileExtension

The default file extension for this type is MIME type (if it is not specified in the file download request itself)

Example:

// Adding the ability to download a PDF in current web view.
WebView.IOS.AddDownloadMimeType("application/pdf","pdf");
// Adding the ability to load one of the mimetypes for music in the current web view.
WebView.IOS.AddDownloadMimeType("audio/aac","aac");

IOS-Icon

void RemoveDownloadMimeType(string MimeType)

Remove the MIME type in the download files checklist. (IOS only).

Parameters:

string MimeType

MIME type.

Example:

// Remove the ability to download a PDF in current web view.
WebView.IOS.RemoveDownloadMimeType("application/pdf");

IOS-Icon

void SetToolbarTintColor(string HexColor)

Sets the toolbar color. (IOS only).

Parameters:

string HexColor

Sets color in Hex-color.

Example:

// Sets the toolbar color in current web view.
WebView.IOS.SetToolbarTintColor("#87cefa");

IOS-Icon

void SetToolbarTextColor(string HexColor)

Sets the toolbar text color. (IOS only).

Parameters:

string HexColor

Sets color in Hex-color.

Example:

// Sets the toolbar text color in current web view.
WebView.IOS.SetToolbarTextColor("#87cefa");