In my case for instance any JS scripts added to the called page is working first time when entering the page, after going back and calling that page again the scripts in general do not work or run anymore and no errors in the console.
I tried also with facebook SDK JS putting the code inside the pageInit or using the code below
and it runs the code one time and then when going back to entering the page again the script is not called anymore or not working…
any ideas for fix this? in all pages happen the same when you need to have a script that only works for that page…
I know I can put the scripts in the index page but Facebook sdk needs to access the DOM elements when the JS is added and there is no elements yet until the page containing the login screen is called…
my code :
pageInit: function(e, page) {
console.log(‘pageInit’, page);
var self = this;
var app = self.$app;
var fruits = self.fruits;
var $ = self.$;
var s = document.getElementsByTagName('script')[0];
var sc = document.createElement('script');
sc.type = 'text/javascript';
sc.async = false;
sc.src = 'js/fb.js';
s.parentNode.insertBefore(sc, s);
},
only refreshing the page make the script working again but only run one time… for that page not the second time I call the page any solutions ? thanks