Z
Z
Zimaell2019-03-16 17:22:33
API
Zimaell, 2019-03-16 17:22:33

How to interact with the extension?

I'm trying to make an extension that will save information on my site when a certain button is pressed, then insert this information on another site when another button is pressed there.
How to save information to the buffer, I can’t find the information ...
How to paste it too, I wrote a short test

document.addEventListener('DOMContentLoaded', function() {
var checkPageButton = document.getElementById('checkPage');
    checkPageButton.addEventListener('click', function() { 
               document.getElementById('test_1').innerHTML='test'; //если блок
               document.getElementById('test_2').value='test'; // если поле

    }, false);
}, false);

this id is in popup.html and it will display it there, but if there is a field on the page of the desired site with the same id, for example, then it gives me an error
Uncaught TypeError: Cannot set property 'value' of null
Uncaught TypeError: Cannot set property 'innerHTML ' of null
In general, if anyone knows how to set values ​​​​through extensions for third-party sites, as well as save info to the buffer, I will be glad if you share, or if anyone has links to similar topics...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question