Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
alistudio60

Can I set my homepage to a different page for mobile only

Question

Is it possible to set the homepage on mobile device as a different page in your site rather then the page that opens for desktop. I would like my mobile site to open directly to a project/section rather then opening to a cover page.

Edited by alistudio60
Initial Revision

Share this post


Link to post

16 answers to this question

Recommended Posts

  • 5

Hi

Yes, there's a workaround you can add for this. The code below assumes that the mobile version of your home page has the URL 'mobile'. Add the following code to the Code Injection area of the desktop Home page (you'll find this on the page settings on the Advanced tab):


<script>
if (screen.width<760) {window.location="/mobile";}
</script>


Paul


UPDATEI've updated this answer to allow for devices with higher resolutions and to allow testing on browsers when the width has been reduced.

Use the code below instead, adjusting the URL and the width (in pixels) to match your needs:


<script>
if (document.documentElement.clientWidth <760) {
 window.location = "/mobile";
}
</script>


Edited by Paul2009
Initial Revision

If a response has helped you, please give thanks using the  like-20-mag.png.3997345d620e40b4760b5d7a667cad54.png button.
Need personalised help? I'm a professional Developer who works with Designers internationally. You can book me via my company's website. www.sf.digital

Share this post


Link to post
  • 0

Hi @Paul2009

That didn't work unfortunately, all I got was a warning message on mobile saying 'we couldn't find the page you were looking for...' can you advice further please.

To clarify again I have a homepage that is just an image which is fine for desktop but on mobile I would like the site to open directly to one of the project pages and ignore this full image page which is fine for desktop.

Thanks

Share this post


Link to post
  • 0

Hi @Paul2009

That didn't work unfortunately, all I got was a warning message on mobile saying 'we couldn't find the page you were looking for...' can you advice further please.

To clarify again I have a homepage that is just an image which is fine for desktop but on mobile I would like the site to open directly to one of the project pages and ignore this full image page which is fine for desktop.

Thanks

Share this post


Link to post
  • 0

As I mentioned in the answer, the page you are sending the mobile users to must have the URL of '/mobile'. If not, you will need to change the answer to match the URL of the mobile home page. Try that.

You haven't provided a link to your site and I'm unable to troubleshoot further without one.


If a response has helped you, please give thanks using the  like-20-mag.png.3997345d620e40b4760b5d7a667cad54.png button.
Need personalised help? I'm a professional Developer who works with Designers internationally. You can book me via my company's website. www.sf.digital

Share this post


Link to post
  • 0

Hi, it looks like this solution works for everyone but I am getting a "Syntax Error" message on the first line of the code. Is there a way to fix this? Thanks a lot in advance.

Share this post


Link to post
  • 0

I'd need more information. For example, a screenshot of where you added the code and the website URL.


If a response has helped you, please give thanks using the  like-20-mag.png.3997345d620e40b4760b5d7a667cad54.png button.
Need personalised help? I'm a professional Developer who works with Designers internationally. You can book me via my company's website. www.sf.digital

Share this post


Link to post
  • 0

Thanks for the screenshot. I can see that you've inserted the code into Custom CSS but this isn't the correct location for the code. See the answer above. It should be inserted into the Code Injection area. You'll find this in the home page's settings. Whilst viewing the home page, click the black Settings label.


If a response has helped you, please give thanks using the  like-20-mag.png.3997345d620e40b4760b5d7a667cad54.png button.
Need personalised help? I'm a professional Developer who works with Designers internationally. You can book me via my company's website. www.sf.digital

Share this post


Link to post
  • 0

Beware of "noindex"/hide from search engines option on any of your pages that you redirect to (like your mobile friendly page), as per this thread:
 

 

Share this post


Link to post
  • 0

Hi Paul, just wanted to say thank you for that, and one small comment for anyone who's new to making these kinds of changes to Squarespace:

I'm guessing the best place to put this code is in the Page Header Code Injection (in the Advanced portion of the page settings)?

Share this post


Link to post

Create an account or sign in to comment

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


×
×
  • Create New...