Skip to content

Instantly share code, notes, and snippets.

View jsnelders's full-sized avatar
💭
Exploring different ideas. Creating value. Slinging code.

Jason Snelders jsnelders

💭
Exploring different ideas. Creating value. Slinging code.
View GitHub Profile
@jbinto
jbinto / getTitleNative.js
Created January 13, 2016 07:32
Get title from remote HTML URL - without jQuery
// 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;