Form needs refreshed every time I open the page - HELP!

Occasional Contributor

I have the free hubspot account and have the form on various pages of my site. It was working fine for awhile but now every time I navigate to a page with the form, I have to refresh the page for the form to appear. It's also not just me and it's not just desktop or mobile. I'm using Squarespace if that helps.

 

Anyone experienced this issue and can help me troubleshoot?

 

Thanks in advance!

Reply
0 Upvotes
8 Replies 8
Top Advisor | Platinum Partner

@Kastaglance - Do you have a preview link that we can view?

Reply
0 Upvotes
Occasional Contributor

https://www.judy4garrettcounty.com/citizen-guided-local-government

 

For now I just added a line of text because I cannot figure it out! haha. It seems as though the first time I go to the website it shows up. Then subsequent pages I navigate to it doesn't show. Below the image I am also including an email conversation I had with my brother in law who is an actual developer. Maybe it can help you help me 🙂Screen Shot 2018-09-18 at 12.30.33 PM.png

 

I looked at the response headers coming from the site and it isn't specifying any cache-control headers, so browsers are more than likely caching the page locally.  If someone has already visited the site, they have to refresh the page or wait until the browser cache expires.  New users to the site will see the new html (and the form) immediately.  
 
It’s sometimes a tricky problem to solve because HTML doesn’t control the caching.  It’s controlled by the HTTP protocol.  The headers have to be sent by the server.  There might be some settings in your content management settings which will disable caching.  Disabling caching can make pages load slower for frequent visitors, but in today’s crazy fast internet it doesn’t usually matter.
 
I use code to send these headers:
Cache-Control:
no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:
no-cache
Expires:
-1
 
If you want your client to see the new changes immediately you can just have them click this URL similar to this https://www.judy4garrettcounty.com/?update123 which will trick the browser into reloading it.  Try the link and see if it fixes the issue on your end.  
 
I almost be it’s a browser caching issue.  It happens a lot on our public website.  I also run into it loading images and javascript files and I usually use this question mark trick in my HTML (with my app’s version number) to make it re-fetch the latest files.  It’s a pain, but also if you just wait a day, eventually the cache expires and everything is fine.
Top Advisor | Platinum Partner

@Kastaglance - So, the theme you are using for squarespace, is not making round trips when you navigate to new pages, it's just changing out the html of the content div based on the link clicked. This is causing the HS code to not re-execute whenever a link is clicked. I did notice that your footer content never refreshes. If there is any way you can throw your form into the footer, that should solve your problem.

Reply
0 Upvotes
Occasional Contributor

Any other workaround? @tjoyce

Reply
0 Upvotes
Top Advisor | Platinum Partner

@Kastaglance - I tried to dynamically inject the form but couldn't find an elegant way to do it. Do you have any ideas @Jsum ?

Reply
0 Upvotes
Esteemed Advisor | Partner

@tjoyce, I can't recreate the issue on my end. I'm seeing the form on every page. 

 

@Kastaglance I found this: https://answers.squarespace.com/questions/203099/can-i-force-clear-my-sites-not-my-browsers-cache-t.... which basically said that squarespace customer support can force clear your cache.

 

again, I'm seeing the form on all of your pages. I don't think there is an issue except maybe with browsers that visited your site before the form was added, like you mentioned. It is possible the issue is on your end. I fought with my ISP and hosting company for months before someone told me to open a command prompt and enter this:

ipconfig /flush dns

It turns out the caching was happening in my router and ever since then I use this when faced with caching issues and it generally works. I'm not telling you to do this specifically but if you clear your browser cache and flush your dns but are still seeing it then it is the server and can be solved by calling their support to request a flush. 

 

If it is your users browsers you could also setup a javascript redirect to the same url only with a query, like was mentioned above. I can't imagine that is good practice though. Maybe you could use a function that injects the embed into the page after load? 

 

Need help? Hire Us Here

Reply
0 Upvotes
Top Advisor | Platinum Partner

@Jsum - looks like she fixed it by adding the form to the footer. That might be why you couldn't see what I was seeing.

Reply
0 Upvotes
Occasional Contributor

Yep, thanks for the suggestion! If it were a website I owned, I'd likely continue my research on a workaround. But, this did just fine. THANK YOU!!!