Skip to content

Commit 7be5b72

Browse files
authored
js script to adapt absolute paths
1 parent 229239e commit 7be5b72

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

public/embeds/js/script.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script>
2+
const baseUrl = "https://gpx.studio";
3+
4+
document.querySelectorAll('[href], [src], [action]').forEach(el => {
5+
['href', 'src', 'action'].forEach(attr => {
6+
const val = el.getAttribute(attr);
7+
if (val && val.startsWith('/')) {
8+
el.setAttribute(attr, baseUrl + val);
9+
}
10+
});
11+
});
12+
</script>

0 commit comments

Comments
 (0)