I created a search bar that searches JSON and displays the info in html with an "open link" button. The files are local kmz/kml files that are opened up in Google Earth when a user clicks the button.
Why when I click the open button does Google Earth load it and then I receive a pop-up in my app that says "Another program is currently using this file" and then won't clear till i restart the app?
$(document).ready(function() {
$('#myInput').keyup(function() {
$('#aceCategory').html('');
var searchField = $('#myInput').val();
var expression = new RegExp(searchField, "i");
$.getJSON('jsoncleanmaster.json', function(data) {
$.each(data, function(key, value) {
if (value.category.search(expression) != -1 ||
value.name.search(expression) != -1 ||
value.desc.search(expression) != -1 ||
value.url.search(expression) != -1) {
$('#aceCategory').append("<tr>" + "<td>" + "<b>" +
value.name + "---" + "(" + value.category + ")" + "</b>" + "<br>" +
value.desc + "</br>" + "<input type='button' id='openBtn1' style='border-radius: 25px; outline: none' value='Open Link' >" +
"</td>" + "</tr")
const shell = require('electron').shell;
$(document).on("click", "#openBtn1", function(event) {
shell.openItem(value.url);
})
}
});
})
});
});