I am trying to integrate Parse in Unity Webgl build. As there is no specific SDK for WebGL provided by parse so for parse communication i am using RestAPI to Get the data from parse. As provided in parse help first i have created a user at the parse dashboard. Using those credentials i first login to the parse from the app using following code:
WWWForm form = new WWWForm();
var headers = form.headers;
headers["X-Parse-Application-Id"] = ParseHandler.Instance.ApplicationID;
headers["X-Parse-REST-API-Key"] = ParseHandler.Instance.RestApiKey;
headers["Content-Type"] = "application/json";
WWW www = new WWW("https://api.parse.com/1/login?username=abc&password=abcpassword", null, headers);
yield return www;
if (www.error != null)
{
isInitialized = false;
}
else
{
isInitialized = true;
}
After login in successfully i try to get the data of specific person using following code:
WWWForm form = new WWWForm();
var headers = form.headers;
headers["X-Parse-Application-Id"] = ParseHandler.Instance.ApplicationID;
headers["X-Parse-REST-API-Key"] = ParseHandler.Instance.RestApiKey;
headers["Content-Type"] = "application/json";
WWW www = new WWW("https://api.parse.com/1/classes/PlayerProfile?where={\ "ID\ ":\ "20489\ "}",null,headers);
if (www.error != null)
{
if (responseDelegate != null)
responseDelegate(null);
}
else
{
if (responseDelegate != null)
responseDelegate(www.text);
}
When i open this WebGL build on Firefox after login in to facebook parse starts initializing and it works perfectly fine. It do login and get the data but when i try to Open the build on Google Chrome it gives following error and parse doesn’t able to login or get data from parse:
Refused to set unsafe header "User-Agent"
Please help how can i fix this issue. As we don’t want to shift this app to webplayer as chrome doesn’t support webplayer, also it has a prerequisite of downloading unity webplayer and all our data is already maintained on parse for different platforms.
I have hosted the app at the following link :
“https://www.leatherjacketmaster.com/goa/index.html”
↧