Welcome Guest, Not a member yet? Register   Sign In
sending a message from a CI application to a content script
#6

(This post was last modified: 10-19-2018, 05:26 AM by richb201.)

(10-18-2018, 10:23 PM)ciadmin Wrote: You are correct - a background script can "talk" to a CI daemon.
I don't know how to go the other way ... web sockets, perhaps? I have seen some awkward impolementations that try to integrate that with PHP.

Well, I have found some examples of an HTML page with js code "injected" sending messages to a content script. Someone talked about doing this in an iframe (whatever that is). BTW, I really don't need the content script to "send messages back" to the web page. This is because the content script talks with the background script and the background script talks to both the Extension (it is actually part of the extension) AND the daemon on the server (via AJAX).  

I just don't know how to create an iframe in a CI generated HTML page??  Any idea how to do that?

I have managed to get the icon for the extension to appear differently whenever my CI app is up and running in one of the browser tabs. But when the tab with the CI app closes, I'd like it to go back to the original. Right now it won't go back to the original until I reload the Extension! Not optimal.

I found this code to send a message from an html page to a be "caught" by a content script.
Code:
       <script>
           var go = function() {
               var event = document.createEvent('Event');
               event.initEvent('hello');
               document.dispatchEvent(event);
           }
       </script>
       <a href="javascript:go();">Click me</a>
I understand how it is supposed to work except the last line, javascript:go()?? I guess that runs the go function? Can I get this function go to run by itself without a click?
proof that an old dog can learn new tricks
Reply


Messages In This Thread
RE: sending a message from a CI application to a content script - by richb201 - 10-19-2018, 04:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB