Answer the question
In order to leave comments, you need to log in
How to fix weird error while initializing api?
There is an application for classmates, the start page of which (opens in a frame) is a page with an address of the form site.ru/app/index.php. When it is opened, the api is initialized and it is used to call users.getCurrentUser. Everything works fine, api returns correct data.
But if you follow the link located in the application itself (to the same address of the application page), then an error appears when initializing the api Uncaught TypeError: Cannot read property 'indexOf' of undefined (fapi5.js: 1) I
connect and initialize the api like this:
<script type="text/javascript" src="http://api.odnoklassniki.ru/js/fapi5.js"></script>
var rParams = FAPI.Util.getRequestParameters();
FAPI.init(rParams["api_server"], rParams["apiconnection"],
function() {
console.log("ok");
},
function(error){
console.log("error");
}
);
Answer the question
In order to leave comments, you need to log in
The problem is that FAPI.Util.getRequestParameters() returns an empty array. This function returns values based on GET parameters in the address bar. Pay attention to what goes on the site.ru/app/index.php page after the "?" (for example, ?pageId=42476523). All internal pages in the frame must also contain these parameters.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question