Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Vanilla JS to open tabs with urls from every first tb of every row except the first in the first table of an html page
// This gist assumes that in a table, every first tr of every td
// will have text that is a valid url.
// It will open blank tabs with each
// Beware huge tables.
// Also it will prompt pop-up protection on Chrome, so check that off
// after running it once for a new source page.
const tables = document.getElementsByTagName('table')
const table = tables[0] // use first table
for (let i = 1; i < table.rows.length; i++) {
const url = table.rows[i].cells[0].textContent
console.log({url});
window.open(url, '_blank');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment