Skip to content

Instantly share code, notes, and snippets.

View oussama-he's full-sized avatar
🔍
Seeking a job opportunity

Oussama Heloulou oussama-he

🔍
Seeking a job opportunity
  • Jijel, Algeria
View GitHub Profile
@oussama-he
oussama-he / getTitleNative.js
Created April 20, 2019 16:48 — forked from jbinto/getTitleNative.js
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;