简体   繁体   中英

How to get url of current window when using Facebook Unity sdk

I tried calling:

Application.ExternalEval("UnityObject2.instances[0].getUnity().SendMessage('GameObjectName', 'SomeFunctionHere', document.URL);");

Which works great, but it could only retrieve the frame's url (it is a very long random html link) instead of the outer top most like https://apps.facebook.com/appnamehere . I also tried window.top.location.href but it gives me a security error since it wasn't allowed.

I need to process the url before I even init, so I cannot use fb's deeplink or anything like that. Any ideas on how to get the url? I'm using 5.0.4 of the SDK on Facebook Canvas.

由于跨域安全性,因此无法获得顶级网址。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM