
JavaScript
326
Вклад в тег
<script src="https://cdnjs.cloudflare.com/ajax/libs/localforage/1.9.0/localforage.js"></script>
result = await localforage.setItem('key', save_data);
console.log('Данные успешно сохранены:');
console.dir(result);
result = await localforage.getItem('key');
console.log('Данные успешно извлечены:');
console.dir(result);
// Создадим простой текстовый файл:
var data = 'Здесь текст для файла или положите в переменную Blob';
var file = new File([data], 'primer.txt', {type: 'text/plain'});
// Создаем коллекцию файлов:
var dt = new DataTransfer();
dt.items.add(file);
var file_list = dt.files;
console.log('Коллекция файлов создана:');
console.dir(file_list);
// Вставим созданную коллекцию в реальное поле:
document.querySelector('input[type="file"]').files = file_list;
<input type="file">
- что просто архиполезно для браузерных ботов.document.body.addEventListener('mouseenter', function(e) {
console.log(e.target);
});