New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetUrl() #8
Comments
The portable way is // In JavaScript
window.addEventListener("onpageshow", function(){
Unity.call("url:" + window.location.href);
}, false); // In C#
string mUrl;
void Start()
{
webViewObject = (new GameObject("WebViewObject")).AddComponent<WebViewObject>();
webViewObject.Init((msg)=>{
if (msg.StartsWith("url:")) {
mUrl = msg.Substring(4);
}
});
}
public string getUrl()
{
return mUrl;
} |
I don't know where to put the javascript code? thank you |
For example, void Start()
{
webViewObject = (new GameObject("WebViewObject")).AddComponent<WebViewObject>();
webViewObject.Init((msg)=>{
if (msg.StartsWith("url:")) {
mUrl = msg.Substring(4);
}
});
webViewObject.EvaluateJS(@"
window.addEventListener('onpageshow', function(){
Unity.call('url:' + window.location.href);
}, false);
"); |
suppose the user navigates away from the loaded page. can I query the URL of the new location somehow? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it possible to have a method getUrl which to return the current url
Thank you
The text was updated successfully, but these errors were encountered: