Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //contentscript.js
- function timedFunction() {
- var txt ="shan";
- chrome.extension.sendRequest({method:"text",key:txt}, function(response) {
- d=response.data;
- alert(d);
- });
- setTimeout("timedFunction()",2000);
- }
- timedFunction();
- //background.html
- <!DOCTYPE html>
- <html>
- <head>
- </head>
- <body>
- <script type='text/javascript'>
- chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
- if (request.method == "text")
- {
- sendResponse({data:request.key});
- }
- else
- {
- }
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement