Jump to content

Audio Blocks opening new window in IOS

Go to solution Solved by paul2009,

Recommended Posts

Posted (edited)

Site URL: https://www.eliblock.co.uk

Hi there,

I just launched my new site which is an audio portfolio. I find that when I click on my audio blocks from an iphone it opens the player in a new window. When on a desktop it's fine. 

Is there a way to stop this from happening? So it just stays on the player on the main site page?

Any help would be much appreciated.

Thanks!

Eli

Edited by eliblock
Posted

This is most likely a relatively new issue for audio blocks. The audio blocks included by Squarespace are incredibly depreciated blocks and next to useless for modern uses in my opinion. Although, looking at your website, I do really like what you've done to customize them. My apologies if this seems rude but I'm very critical of these particular blocks and they need to be updated.

I'd recommend you raise issue with the performance to customer support and hopefully they revamp these blocks soon. Otherwise, the answer is no. On mobile, they're seen as independent files and cannot be played in the page itself. Not easily at least. I'd recommend using an external plugin or hosting them through SoundCloud. If not SoundCloud, the ElfSight audio widget is fantastic.  

Posted

Ah thanks for the feedback. Elfsight looks quite good and I've used soundcloud plenty.

I was hoping this was something you can sort with CSS, it would be a pain to re upload everything!

 

  • Solution
Posted (edited)
On 11/8/2021 at 9:13 PM, eliblock said:

When I click on my audio blocks from an iphone it opens the player in a new window. Is there a way to stop this from happening?

On iOS devices (iPhones, iPads) Audio Blocks detect that iOS is being used and they default to the built-in iOS player that opens on a new page. 

You should be able to stop this by using some code to tell the Squarespace Audio Block that the visitor is not using iOS. This should prevent the block attempting to invoke the built in iOS player.  To do this, add the following script to Settings > Advanced > Code Injection > Footer:

<script>
  window.addEventListener("load", function(){
    Y.UA.ios = 0; 
  })
</script>

Note: This was tested on a Squarespace 7.1 site running Safari on iOS 15.

  If my post helped you, please click a 'Like' or 'Thanks' icon below  ⬇️

Edited by paul2009

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Posted

Ah thanks Paul - code injection appears to be a premium feature?

Googling I came across this but have no idea - coding not my strong suit!!

//Prevent iOS from opening audio blocks in new window

<script>

Y.on('domready', function(){

Y.UA.ios = 0; //Y.UA object have test key for different platforms.

//Setting ios value to 0 here allow to skip default Audio Block's behavior

})

 </script>

 

Thanks for your help!

Posted
6 hours ago, eliblock said:

Googling I came across this

You’ve just posted a copy of what I’ve already provided so this isn’t anything new. You’re right that you can’t add script if you are on a Personal Plan, which means you won’t be able to change the audio block’s behaviour or use an alternative player. You will require a Business Plan. 

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

  • 2 weeks later...
Posted
On 11/9/2021 at 11:27 PM, paul2009 said:

You’ve just posted a copy of what I’ve already provided so this isn’t anything new. You’re right that you can’t add script if you are on a Personal Plan, which means you won’t be able to change the audio block’s behaviour or use an alternative player. You will require a Business Plan. 

Thanks Paul. Yes I got in touch with Squarespace, they were pretty unhelpful, seems upgrading to business is the only workaround, which seems a little short sighted to me. Thanks for the help!

  • 2 years later...
Posted
On 6/4/2024 at 2:52 AM, xjws said:

Hi, hope all is well. 🙂 I copied a code to stop an audio player from opening in a different window especially on iphones however it still opens in a different window that says static space.  Is there a new code? Can anyone please help me with this? I'm trying to use it for different clients. Unfortunately I haven't been able to find any codes that will prevent this from happening. Please advise. Many Thanks, Can  Here's the Url to site https://www.hitmanjoe.com/

The code I used was: 

<script>
  window.addEventListener("load", function(){
        Y.UA.ios = 0; //Y.UA object have test key for different platforms.
    //Setting ios value to 0 here allow to skip default Audio Block's behavior
  })
</script>

 

<script>
  window.addEventListener("load", function(){
    Y.UA.ios = 0; 
  })
</script> (footer in code injection)

I solved this for a member last night. They confirm it is fixed, but I don't sure if it works or not, you can check this site url, if it works in your end, I will give you guide to fix it.

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

  • 4 weeks later...
Posted
On 6/5/2024 at 5:13 AM, tuanphan said:

I solved this for a member last night. They confirm it is fixed, but I don't sure if it works or not, you can check this site url, if it works in your end, I will give you guide to fix it.

 

Just used this and it solved the problem! Thank you, Tuan!

Thank you everyone else for inquiring and responding!!

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.