Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Posts: 1
Registered: ‎07-19-2012
My Device: BlackBerry 10 Dev Alpha
My Carrier: Orange

WebView evaluateJavaScript problem

[ Edited ]


I'm writting application in Cascades and I want to use Google Maps API.
I'm loading HTML web page to WebView. Web page is including simple JavaScript code with Google Maps API.
When I run application on device, everything works fine. Maps load correctly.

Now I want call some functions that are defined in script section on web page. I use evaluateJavaScript(), but this function can't find any code that is implemented on the web page.
Console every time says:

JS Console: undefined:0: ReferenceError: Can't find variable: ....

I have tried to put JavaScript in separate file js but still not working.

When I evaluate all JavaScript in function evaluateJavaScript() i can call it, but I still have problem with Google Maps API.

Google API is included as a link in src property. evaluateJavaScript didn't work with any google api functions, console always says: Cant't find variable ..

I have tried put this code, but still nothing.

QStringList script;
 script << "function loadScript() {"
     << "var script = document.createElement(\"script\");"
     << "script.type = \"text/javascript\";"
     << "script.src=\"http://maps.googleapis.com/maps/api/js?key=key&sensor=FALSE\";"
     << "document.body.appendChild(script);}";


Can anybody help me?
Thanks for reply.

ps I'm sorry for my poor English, I hope that is understandable for all.


ps2 Problem solved. New Cascades tutorial told me everything.