0
방금 특정 키워드에 대한 트윗을 표시하는 간단한 크롬 확장 프로그램을 만들었습니다. 그것은 잘 작동합니다. 사용자가 확장 아이콘을 클릭하면 새 트윗이 사용 가능할 때마다 표시됩니다.Chrome 확장 프로그램에 대한 알림 표시
그러나 확장 아이콘에 새 데이터가 검색되었음을 나타내는 알림을 표시하는 방법이 있습니까? 여기
여기var req=null;
window.onload = function() {
req = new XMLHttpRequest();
req.open("GET", "http://search.twitter.com/search.atom?q=20SongsThatILike", true);
req.onload = showTweets;
req.send(null);
}
function showTweets() {
var title=req.responseXML.getElementsByTagName('title')[1].childNodes[0];
var author=req.responseXML.getElementsByTagName('author')[1].childNodes[0].childNodes[0];
document.body.appendChild(title);
}
내 HTML 코드
<html>
<head>
<title>Getting Started Extension's Popup</title>
<style>
body {
min-width:357px;
overflow-x:hidden;
}
img {
margin:5px;
border:2px solid black;
vertical-align:middle;
width:75px;
height:75px;
}
</style>
<!-- JavaScript and HTML must be in separate files for security. -->
<script src="script.js"></script>
</head>
<body>
</body>
</html>
입니다 그리고 여기 manifest.json을
{
"name": "My First Extension",
"version": "1.0",
"manifest_version": 2,
"description": "The first extension that I made.",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"http://search.twitter.com/*"
]
}
가
예, 있습니다. 하지만 [무엇을 시도 했습니까?] (http://www.whathaveyoutried.com/) – Cerbrus
위 코드를 업데이트했습니다 – iJade
예, [long polling or sockets] (http://techoctave.com/c7/posts/) 60-simple-long-polling-example-with-javascript-and-jquery). 나는 당신에게 시도해 보라고 권하고, 그 문제를 구현하는데 문제가 있다면, 다시 물어보십시오. – jjperezaguinaga