How to allow Google Calendar and ICS to open in a new tab - Squarespace 7.1
There might be times you want all your external links to open in a new tab. Currently on the events pages, the calendar links open within the page itself.
Below is some code to make this now possible.
Add this to your Code Injection -> Footer
<!-- Events - Open Google Calendar in New Tab -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('li.eventitem-meta-item.eventitem-meta-export.event-meta-item a').attr('target','_blank');
});
</script>
<!-- Events - Open Google Calendar in New Tab -->
<!-- Events - ICS in New Tab -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('a.eventlist-meta-export-ical').attr('target','_blank');
});
</script>
<!-- Events - ICS in New Tab -->