Welcome Guest, Not a member yet? Register   Sign In
need to communicate with Extension
#3

(This post was last modified: 04-14-2019, 05:07 AM by richb201.)

Yes, Insite, that is what I am following.

Sending messages from web pages
Similar to cross-extension messaging, your app or extension can receive and respond to messages from regular web pages.

a few lines down they have this example:

// The ID of the extension we want to talk to.
var editorExtensionId = "abcdefghijklmnoabcdefhijklmnoabc";

// Make a simple request:
chrome.runtime.sendMessage(editorExtensionId, {openUrlInEditor: url},
 function(response) {
   if (!response.success)
     handleError(url);
 });

I thought maybe I could wrap this in javascript and drop it into the init function in my Controller:
PHP Code:
    private function _init()
 
     {

 
         $this->output->set_template('default2');

 
         $this->load->js('assets/themes/default/js/jquery-1.9.1.min.js');
 
         $this->load->js('assets/themes/default/hero_files/bootstrap-transition.js');
 
         $this->load->js('assets/themes/default/hero_files/bootstrap-collapse.js');
 
         $this->load->js('js/jquery.orgchart.js');     // for charts

 
         echo '<script type="text/javascript">'
 
         var editorExtensionId "abcdefghijklmnoabcdefhijklmnoabc";

 
       // Make a simple request:
 
       chrome.runtime.sendMessage(editorExtensionId, {openUrlInEditorurl},
 
       function(response) {
 
            if (!response.success)
 
              handleError(url);
 
                    };
 
         '</script>'
 
     
But that 2nd line with the var is causing a parsing error. Am I going down the right path here? I assumed that I need to run javascript, but I guess I need to have it appear the rendered html, right? How do I do that?
proof that an old dog can learn new tricks
Reply


Messages In This Thread
need to communicate with Extension - by richb201 - 04-12-2019, 06:42 AM
RE: need to communicate with Extension - by richb201 - 04-14-2019, 05:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB