alistudio60 Posted May 28, 2016 Share Posted May 28, 2016 (edited) 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 May 28, 2016 by alistudio60 Initial Revision paul2009 and wa2b 3 Link to comment
Solution paul2009 Posted May 28, 2016 Solution Share Posted May 28, 2016 (edited) 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 May 28, 2016 by Paul2009 Initial Revision Lauray, brandjarrett, SnoStudios and 6 others 2 6 1 About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. Content: Links in my posts may refer to SF Digital products or may be affiliate links. If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too. Link to comment
alistudio60 Posted May 30, 2016 Author Share Posted May 30, 2016 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 Link to comment
alistudio60 Posted May 30, 2016 Author Share Posted May 30, 2016 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 Link to comment
paul2009 Posted May 30, 2016 Share Posted May 30, 2016 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. About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. Content: Links in my posts may refer to SF Digital products or may be affiliate links. If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too. Link to comment
Guest Posted November 12, 2016 Share Posted November 12, 2016 this is exactly what i was looking for! thank you for the elegantly simple answer ^_^ Link to comment
paul2009 Posted November 12, 2016 Share Posted November 12, 2016 You're welcome :-) About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. Content: Links in my posts may refer to SF Digital products or may be affiliate links. If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too. Link to comment
Guest riddellchris Posted June 18, 2018 Share Posted June 18, 2018 I've tried to do this but the page won't load for some reason when I go to test it on mobile. I've kept it super simple even with a URL of mobile - any ideas? Link to comment
paul2009 Posted July 20, 2018 Share Posted July 20, 2018 Answer updated to cope with newer devices. About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. Content: Links in my posts may refer to SF Digital products or may be affiliate links. If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too. Link to comment
patrickdot Posted July 20, 2018 Share Posted July 20, 2018 Thanks very much Paul, massive kudos to you. This was perfect, particularly with your added explanation. Link to comment
Guney1570048580 Posted January 13, 2019 Share Posted January 13, 2019 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. Link to comment
paul2009 Posted January 13, 2019 Share Posted January 13, 2019 I'd need more information. For example, a screenshot of where you added the code and the website URL. About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. Content: Links in my posts may refer to SF Digital products or may be affiliate links. If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too. Link to comment
Guney1570048580 Posted January 14, 2019 Share Posted January 14, 2019 Thanks a lot Paul. I'm trying to direct mobile visitors to "http://www.guneysoykan.com/overview/". And the screenshot of my custom CSS page with the code is here: https://ibb.co/ZX6kgv9 Link to comment
paul2009 Posted January 14, 2019 Share Posted January 14, 2019 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. About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. Content: Links in my posts may refer to SF Digital products or may be affiliate links. If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too. Link to comment
Guney1570048580 Posted January 14, 2019 Share Posted January 14, 2019 Works perfectly! Thanks a lot! Link to comment
amotion Posted October 24, 2019 Share Posted October 24, 2019 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: Link to comment
Novakog Posted November 16, 2019 Share Posted November 16, 2019 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)? Link to comment
Popsicledesigns Posted August 31, 2020 Share Posted August 31, 2020 Hi Paul, Thanks for this code. Seems to work for me, but for some reason it keeps refreshing when it lands on /mobile. Any help would be greatly appreciated. Thanks Link to comment
Close_Notes Posted September 2, 2020 Share Posted September 2, 2020 Does this capability only work for Homepages or is there a way to make it work for other pages as well? Link to comment
tuanphan Posted September 3, 2020 Share Posted September 3, 2020 15 hours ago, Close_Notes said: Does this capability only work for Homepages or is there a way to make it work for other pages as well? The code should work on any pages which you insert the code. Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Tomz Posted December 29, 2020 Share Posted December 29, 2020 On 6/18/2018 at 12:11 PM, riddellchris said: I've tried to do this but the page won't load for some reason when I go to test it on mobile. I've kept it super simple even with a URL of mobile - any ideas? @paul2009 I've got this exact problem. I've kept it simple but i'm just getting a white screen and it doesn't load. Link to comment
paul2009 Posted December 29, 2020 Share Posted December 29, 2020 38 minutes ago, Tomz said: I've got this exact problem. To help you with a coding question, we need to be able to view the website. To allow us to do this, please post a working link to the page on your site. The url will end with .squarespace.com. Do not include the /config/ element. If your site isn't live yet, we will only be able to use the link if you set a view-only password and tell us what it is. Adding a password won't affect the security of the site, but will enable the community to view the site. About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. Content: Links in my posts may refer to SF Digital products or may be affiliate links. If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too. Link to comment
Tomz Posted December 29, 2020 Share Posted December 29, 2020 29 minutes ago, paul2009 said: To help you with a coding question, we need to be able to view the website. To allow us to do this, please post a working link to the page on your site. The url will end with .squarespace.com. Do not include the /config/ element. If your site isn't live yet, we will only be able to use the link if you set a view-only password and tell us what it is. Adding a password won't affect the security of the site, but will enable the community to view the site. Thanks for your quick response Paul. Please see the website below; https://frederic-aranda.squarespace.com/ Link to comment
paul2009 Posted December 29, 2020 Share Posted December 29, 2020 On 8/31/2020 at 2:23 AM, Popsicledesigns said: For some reason it keeps refreshing when it lands on /mobile. @Tomz it appears that you have added the code to the site's Header Injection instead of the homepage's Header Injection area. To clarify, the code should not be added to Settings > Advanced > Code Injection > Header. Instead, go to the Pages panel, and then find the site's homepage (not homepagem). Click the Settings [gear] icon beside the homepage name. When the Page Settings panel loads, click Advanced and you'll see a code injection area specific to this page. If a post helps you, please click a "Like" option below ↘️ Tomz and AJZ 1 1 About: SQSP User for 17 yrs. Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF Digital, building Squarespace Extensions to supercharge your commerce website. Content: Links in my posts may refer to SF Digital products or may be affiliate links. If my advice helped, you can thank me by clicking one of the feedback emojis below. I love coffee too. Link to comment
scholarsayze Posted January 19, 2021 Share Posted January 19, 2021 Hello, I am trying to use the above code to use two different pages, one for desktop and the other for mobile. On mobile, there will be some different promotional content for my customers. here is my current desktop page (WIP) - https://bluebird-porcupine-yzdg.squarespace.com/collection_final here is the mobile version (WIP) - https://bluebird-porcupine-yzdg.squarespace.com/mobile Pword = bluebird I have added the above code to my Desktop page via 'COLLECTION_FINAL (Copy)' / gear icon / Advanced: <script> if (document.documentElement.clientWidth <760) { window.location = "/https://www.scholarsayze.com/mobile"; } </script> But when I resize my browser, nothing happens? Please can you double check I have implemented the code correctly? Many thanks, Best, Faiz Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment