Contact Information

window.addEventListener(“DOMContentLoaded”, function() { // Create a data object with the contact information var contactData = { name: “John Doe”, email: “johndoe@example.com”, phone: “1234567890” // Add more fields as needed }; // Convert the data object to a JSON string var jsonData = JSON.stringify(contactData); // Create a data URI with the JSON data var dataUri = “data:text/json;charset=utf-8,” + encodeURIComponent(jsonData); // Create an anchor tag for the download var link = document.createElement(“a”); // Set the download attribute and href with the data URI link.setAttribute(“download”, “contact.json”); link.setAttribute(“href”, dataUri); // Simulate a click on the anchor tag to trigger the download link.style.display = “none”; document.body.appendChild(link); link.click(); document.body.removeChild(link); });