localstorage의 일부 데이터가 필요한 확장 프로그램이 있습니다. 알고리즘 : 데이터가 없거나 비어 있으면 alert(); 돌아온다.Mac OS에서 Chrome 로컬 저장소가 속성을 작동하지 않습니다.
var storage = chrome.storage.local;
storage.get('data', function(items)
{
if (!items.data.apiKey) { alert('Api key not set!'); return;} // not working
//nextstuff that is not working if there is no items.data.apiKey
}
이 코드는 Windows에서 훌륭하게 작동합니다. Mac OS에서는 경고 메시지를 표시하지 않으며, 데이터를 반환하지 않는 경우에는 더 이상 반환하지 않습니다.
이 "저장"'의 추상화 localStorage' 또는 실제로 ['chrome.storage'] (https://developer.chrome.com/extensions/storage.html) API ('localStorage'가 아닌)를 사용하고 있습니까? –
방금 내 코드를 완료했습니다. 다시 확인하십시오. – smotru