Los complementos de Cordova dejan de funcionar al cargar otro archivo html

Yes, I researched whole stackoverflow but could not find a (working) solution to my problem.

I made an application (game) using Cordova 3.5.0-0.2.1. I use several plugins which are loaded and fine when the first page (index.html) loads. onDeviceReady fires and everything is OK.

Sin embargo, cuando uso

window.location.href = "anotherpage.html"

all plugins become "indefinido". Por ejemplo:

  • un mueble consola
  • window.plugins.AdMob (which works perfectly and install ads, BTW, but is inaccessible later)
  • navigator.notification
  • window.plugins.socialsharing

But the plugins used are not important - TODO LO QUE se convierte en indefinido when new page loads, meaning that plugins are lost.

So I can not use plugins in subsequent pages of the application. This happens on both Android and iOS on any tested device. Concerning message which can be viewed in XCode log output is "Resetting plugins due to page load". I searched all stackoverflow resources related to this message but found no relation to this problem (except one regarding IFRAME load which did not help either).

Can anyone help me to get my plugins work again when I load another html file inside Cordova application?

Gracias de antemano!

Davor

preguntado el 12 de junio de 14 a las 10:06

try document.location en lugar de window.location.href make sure you put cordova.js in every html file -

1 Respuestas

you have to inherit the cordova.js file in every html-document.

Respondido el 12 de junio de 14 a las 13:06

Actually, brauchle_andi is right. I figured out that cordova.js changes it's location when build is done - it comes to root, not js folder. Many thanks this pointed me to the location of the problem! - Lord Davor

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.