ios
This commit is contained in:
13
Assets/3rd/unity-webview/Scripts/UWebView.cs
Executable file → Normal file
13
Assets/3rd/unity-webview/Scripts/UWebView.cs
Executable file → Normal file
@@ -22,6 +22,7 @@ using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Coolape;
|
||||
using System;
|
||||
|
||||
public class UWebView : MonoBehaviour
|
||||
{
|
||||
@@ -149,7 +150,7 @@ public class UWebView : MonoBehaviour
|
||||
#if !UNITY_WEBPLAYER && !UNITY_WEBGL
|
||||
if (Url.StartsWith("http") || Url.StartsWith("file:"))
|
||||
{
|
||||
webViewObject.LoadURL(Url.Replace(" ", "%20"));
|
||||
webViewObject.LoadURL(Uri.EscapeUriString(Url));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -181,17 +182,17 @@ public class UWebView : MonoBehaviour
|
||||
//System.IO.File.WriteAllBytes(dst, result);
|
||||
if (ext == ".html")
|
||||
{
|
||||
Debug.Log("file://" + dst.Replace(" ", "%20"));
|
||||
webViewObject.LoadURL("file://" + dst.Replace(" ", "%20"));
|
||||
Debug.Log("file://" + Uri.EscapeUriString(dst));
|
||||
webViewObject.LoadURL("file://" + Uri.EscapeUriString(dst));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (Url.StartsWith("http") || Url.StartsWith("file:")) {
|
||||
webViewObject.LoadURL(Url.Replace(" ", "%20"));
|
||||
webViewObject.LoadURL(Uri.EscapeUriString(Url));
|
||||
} else {
|
||||
webViewObject.LoadURL("StreamingAssets/" + Url.Replace(" ", "%20"));
|
||||
webViewObject.LoadURL("StreamingAssets/" + Uri.EscapeUriString(Url));
|
||||
}
|
||||
webViewObject.EvaluateJS(
|
||||
"parent.$(function() {" +
|
||||
@@ -202,7 +203,7 @@ public class UWebView : MonoBehaviour
|
||||
" };" +
|
||||
"});");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
public void goBack()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user