Do you have a sample of this somewhere? I'm not finding it.
No, I wrote it for an employer who did not believe in open source. However, it was a pretty simple script, somewhat along the lines of
document.addEventListener('click', (ev) => { const link = ev.target; if ( link.href && link.host === location.host && link.hasAttribute('data-selector') ) { link.classList.add('loading'); fetch(link.href) .then((response) => response.text()) .then((html) => { const loaded = new DOMParser().parseFromString(html, 'text/html'); document.querySelector(ev.target.getAttribute('data-selector')).innerHTML = loaded.body.innerHTML; link.classList.remove('loading'); }); } });
That was the main gist, I updated it with fetch, which wasn't stable at the time then; the history handling was a bit more involved, though.
Or did you mean an example of a transitional app?
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Do you have a sample of this somewhere? I'm not finding it.
No, I wrote it for an employer who did not believe in open source. However, it was a pretty simple script, somewhat along the lines of
That was the main gist, I updated it with fetch, which wasn't stable at the time then; the history handling was a bit more involved, though.
Or did you mean an example of a transitional app?