APIs & Integrations

Ashish
Member

iOS devices redirection issue

We have a HubForm on one of our website and it’s working great with Windows OS. However with iPhone and iPad we’re facing issue with redirection with parameter(?hubres=success)

The reason for the current process is so when someone fills out a content download form in our resources section then they don’t have to fill out any other forms to access other resources. The process works perfectly on every other device. The only devices we have issues with are iPhones and iPads. Hence, if support are able to provide a solution without us re-building our whole resource section it would be appreciated.

0 Upvotes
5 Replies 5
derekcavaliero
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

iOS devices redirection issue

@Developer_Viva

HubSpot has some global utility methods that you can use in conjunction with some custom JS code to launch the modal on pageload when the onFormSubmit callback is run for browsers that do not support the ajax submissions:

hbspt.forms.create({
    portalId: 'xxxxxxxx',
    formId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
    inlineMessage: 'Your submit message here',
    onFormSubmit: function($form){
      if ( window.hubspot.utils.isBrowserIncompatibleWith204FormSubmissions() ) {
        // launch the modal with JavaScript here.
      }
    }
}); 

The window.hubspot.utils.isBrowserIncompatibleWith204FormSubmissions() method returns a boolean value. The method detects if the current browser in use has the bug described above.

@dadams It took me some time to find this method on my own - it would be extremely helpful to have advanced docuemtation somewhere that outlines what all the window.hubspot.utils methods do - they could prove to solve a lot of developers headaches with some more advanced implementation - and because HubSpots source code is compressed - it is hard to gauge what the parameters are and what types they expect.

Derek Cavaliero
Director of Engineering

WebMechanix
www.webmechanix.com
0 Upvotes
Developer_Viva
Member

iOS devices redirection issue

I am Also Getting the same issue. I have added a hubspot form in Popup window but in ios devices it reloaded the page and not able to see thanks u message. please help me to find out the solution.

0 Upvotes
Ashish
Member

iOS devices redirection issue

@dadams Thanks for addressing and providing reference link for the same issue. I will liaise with my client for the same.

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

iOS devices redirection issue

@Ashish

There’s a bug with iOS browsers that force the forms to always redirect to a new page, even when the form is designed not to redirect. We handle this bug be checking to see if the visitor is using an iOS device, and catching that redirect and showing a thank you message instead of reloading the form after that redirect, but we can’t prevent the redirect from happening.

There are some other details in this previous post.

Hi @derekcavaliero This is related to a bug with iOS browsers. Submissions without a redirect will normally return a 204 No Content response if no redirect URL is set, so that the browser won’t navigate to a new page and the thank you message can be displayed. iOS browsers have a bug where they still navigate to the empty 204 page, so to get around that we detect submissions on iOS devices, and redirect back to the page with where the form was submitted, and display the thank you message in …

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

iOS devices redirection issue

@Ashish Do you get an error? Can you expand upon exactly what you are experiencing from the iOS side?

0 Upvotes