diegojmap Posted October 7, 2021 Share Posted October 7, 2021 I need to access a chome extension. I'm using beforeshow in ExtEvents. function window.beforeshow(sender, eOpts) { var extensionId = "pnahlmehglnaomfnngekhphldmbjhdel"; chrome.runtime.sendMessage(extensionId, { message: "certs", body: "list certificates" }, function (response) { console.log(response); }); } Return the message: Cannot read properties of undefined (reading 'sendMessage') What would be the correct way to call it? Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted October 7, 2021 Share Posted October 7, 2021 1 hour ago, diegojmap said: I need to access a chome extension. I'm using beforeshow in ExtEvents. function window.beforeshow(sender, eOpts) { var extensionId = "pnahlmehglnaomfnngekhphldmbjhdel"; chrome.runtime.sendMessage(extensionId, { message: "certs", body: "list certificates" }, function (response) { console.log(response); }); } Return the message: Cannot read properties of undefined (reading 'sendMessage') What would be the correct way to call it? Hello It seems "chrome.runtime" not ready yet. Can you try aftershow event? Link to comment Share on other sites More sharing options...
diegojmap Posted October 7, 2021 Author Share Posted October 7, 2021 Did not work. Not even with Onclick. I'm posting the attachment, if anyone can help. TesteAssinador.rar Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted October 7, 2021 Share Posted October 7, 2021 15 minutes ago, diegojmap said: Did not work. Not even with Onclick. I'm posting the attachment, if anyone can help. TesteAssinador.rar 5.96 MB · 0 downloads This is just a blank project. I can't see any code Link to comment Share on other sites More sharing options...
diegojmap Posted October 7, 2021 Author Share Posted October 7, 2021 I'm using onclick in ExtEvents Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted October 7, 2021 Share Posted October 7, 2021 Just now, diegojmap said: I'm using onclick in ExtEvents Yes, I'm not seeing any code in extevents or unievents. Link to comment Share on other sites More sharing options...
diegojmap Posted October 7, 2021 Author Share Posted October 7, 2021 Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted October 7, 2021 Share Posted October 7, 2021 Just now, diegojmap said: Please check the attached example to your post. It's has a button but no code on extevents. Link to comment Share on other sites More sharing options...
diegojmap Posted October 7, 2021 Author Share Posted October 7, 2021 sorry TesteAssinador.rar Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted October 7, 2021 Share Posted October 7, 2021 3 hours ago, diegojmap said: sorry TesteAssinador.rar 5.96 MB · 2 downloads Hello To able to test this I need the extension too. Link to comment Share on other sites More sharing options...
diegojmap Posted October 8, 2021 Author Share Posted October 8, 2021 I sent message Link to comment Share on other sites More sharing options...
diegojmap Posted October 11, 2021 Author Share Posted October 11, 2021 Hayri ASLAN Could you check? Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted October 12, 2021 Share Posted October 12, 2021 Hello Unfortunately I don't have a solution for this. The extension is developed by you and I don't figure out what you are calling in that extension. Link to comment Share on other sites More sharing options...
diegojmap Posted October 13, 2021 Author Share Posted October 13, 2021 Hayri ASLAN sorry This error appears when accessing any extension. Are you telling me that with unigui I can't access an extension? I showed you a ready-made example. I just need to do it in with Unigui. If you're telling me it's not possible I'm very worried. How to access chrome.runtime.sendmessage with unigui? It has nothing to do with my extension. @Sherzod Link to comment Share on other sites More sharing options...
Elvis Reis Posted October 13, 2021 Share Posted October 13, 2021 I noticed the following problem, when I load a local html file like "file:///C:/Users/elvis/Desktop/example/index.html" the chrome functions are not available, but when I load the same file hosted by a server "http://localhost/index.html" the functions is available. I think it's the same as the way unigui loads files, because the "chrome.runtime.sendMessage" function is not loaded in unigui Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 13, 2021 Administrators Share Posted October 13, 2021 28 minutes ago, Elvis Reis said: file:///C:/Users/elvis/Desktop/example/index.html Such syntax should be avoided. It is only valid on your PC and not valid across WWW. Link to comment Share on other sites More sharing options...
Elvis Reis Posted October 13, 2021 Share Posted October 13, 2021 the problem i have when i use a javascript pro call inside unigui and the same behavior. the function does not exist within unigui chrome.runtime.sendMessage javascript execution. the error he mentioned the extension is not linked to the extension but to native browser functions that are not available within unigui. you can easily simulate the error with the code below. chrome.runtime.sendMessage({message: "hi"}, (response) => { console.log(response.message); }); even without having a listener for the message Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now