This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const envConfig = { | |
development: { | |
SITE_URL: 'http://localhost:3000', | |
API_URL: 'http://localhost:3000/api' | |
}, | |
testing: { | |
SITE_URL: 'https://test.site.com', | |
API_URL: 'https://api.test.site.com' | |
}, | |
production: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Only using native browser features (no jQuery). | |
// Uses `fetch`, `DOMParser` and `querySelectorAll`. | |
const getTitle = (url) => { | |
return fetch(`https://crossorigin.me/${url}`) | |
.then((response) => response.text()) | |
.then((html) => { | |
const doc = new DOMParser().parseFromString(html, "text/html"); | |
const title = doc.querySelectorAll('title')[0]; | |
return title.innerText; |
NewerOlder