Welcome Guest, Not a member yet? Register   Sign In
javascript is being called twice
#1

I managed to get my javascript routine to run. I put the code to call it in in the _construct

$this->load->js("/js/javascript_funcs_extensionloaded.js");

The code is:

   var editorExtensionId = "lamacgnkfoiknjpleghfknfigbmhdaei";


   if (chrome && chrome.runtime && chrome.runtime.sendMessage) {
   chrome.runtime.sendMessage(extensionId, 'snapshot_mode');
}
I am finding that this code is running twice. The way I know this is that the Extension is getting the message "snapshot_mode" twice. Should I be wrapping this js code in 

$(document).ready(function(){
? Or is the problem that I am calling it in __construct()? I want the js code to run just once per initialization of my code. 
proof that an old dog can learn new tricks
Reply


Messages In This Thread
javascript is being called twice - by richb201 - 05-18-2019, 01:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB