Eroor in browser Chrome on SendMessage method

Write this error, then do “SendMessage” to Unity:
“Uncaught TypeError: Object # has no method ‘SendMessage’”

you likely used the wrong thing to call it on then.

Not nessesarily. I just created a post because I have a chrome issue aswell. We also use the SendMessage and this as it seems might be our problem. It worked yesterday, but not today. We have not updated the player between incidents.

(my topic Chrome-issue)

Edit: We use “Application.ExternalEval(…)” to get parameters from the url.

in Unity WebPlayerPage Code change:
in this:
function GetUnity () {
if (navigator.appVersion.indexOf(“MSIE”) != -1 navigator.appVersion.toLowerCase().indexOf(“win”) != -1)
return document.getElementById(“UnityObject”);
else if (navigator.appVersion.toLowerCase().indexOf(“chrome”) != -1)
return document.getElementById(“UnityEmbed”);
else if (navigator.appVersion.toLowerCase().indexOf(“safari”) != -1)
return document.getElementById(“UnityObject”);
else
return document.getElementById(“UnityEmbed”);
}
add
else if (navigator.appVersion.toLowerCase().indexOf(“chrome”) != -1)
return document.getElementById(“UnityEmbed”);

should the space character be there in the “chrom e” (and in the “safar i”)?

EDIT: a quick test say no =) but I cant see how that should fix it as that case should be cought by the else case. Going to try it out though.

it’s a forum bug.

k =) well I can confirm that this fixes the problem if anybody else has the same problem.

We are having the same issue. The GetUnity() solution FoxUmkov posted doesn’t seem to fix the problem for us, though.

FoxUmkov, how did you come upon this solution, and is there a reasoning behind it? I also don’t quite understand how that could fix it, as the else block should return UnityEmbed anyway if it’s not IE or Safari…

Aha, found it. I was putting the chrome check AFTER the safari check - if I put it before the safari one, like in the example posted, it does work :slight_smile: Apparently Chrome’s application version string also contains “safari”. Very annoying.

Thanks FoxUmkov!

Hi i am still having an issue with chrome, even using the above fix. Does any one have any other suggestions?

Welcome to the forum, Cozza13!

Are you getting the same basic problem? Are there any error messages or other details you can give to narrow it down?

I’m having issues with chrome 2, when using the first person character controller.
If you move the mouse cursor outside of unity’s webplayer you have no control anymore, so i can’t turn around as intended.
I fixed it with another script within unity but is requires the user to click on the webplayer first, not really what i wanted…

Reported that problem some time ago about the control disabling itself for the mouse if the mouse leaves the rect, while it works fine on IE etc

I am having this issue and I have changed my code to ensure that Chrome picks it up:

function GetUnity () {
return document.getElementById(“UnityEmbed”);
// return unityObject.getObjectById(“UnityContent”);
//if (navigator.appVersion.indexOf(“MSIE”) != -1 navigator.appVersion.toLowerCase().indexOf(“win”) != -1)
//return document.getElementById(“UnityObject”);
//else if (navigator.appVersion.toLowerCase().indexOf(“chrome”) != -1)
//return document.getElementById(“UnityEmbed”);
//else if (navigator.appVersion.toLowerCase().indexOf(“safari”) != -1)
//return document.getElementById(“UnityObject”);
//else
//return document.getElementById(“UnityEmbed”);
}

yet chrome does not see sendmessage

I have solved it on my end:

The steps i did to solve it.

I rebuilt the game and started with the html output that is the default. Then replaced the pieces to use the html that I had added making sure that where Getunity and the .unity3d elements were in the default html remained in the same order. Then I just replace the output that unity creates for getunity() with the one several people have recommended and it all worked.

function GetUnity () {
if (navigator.appVersion.indexOf(“MSIE”) != -1 navigator.appVersion.toLowerCase().indexOf(“win”) != -1)
return document.getElementById(“UnityObject”);
else if (navigator.appVersion.toLowerCase().indexOf(“chrom e”) != -1)
return document.getElementById(“UnityEmbed”);
else if (navigator.appVersion.toLowerCase().indexOf(“safar i”) != -1)
return document.getElementById(“UnityObject”);
else
return document.getElementById(“UnityEmbed”);
}

i have the same problem,how could i solve it