DNN 9+ How do I create a mobile redirect so mobile devices who hit the sites are automatically redirected to the mobile sites?
Example, Mobile device hits standard site from search, www.domainname.com, redirects to mobile site nested at m.domainname.com
Posted By Will Strohl on 25 Jun 2019 05:07 PM There used to be a built-in option to do this, using a native 51Degrees integration. Unfortunately, DNN Corp removed it from DNN Platform at some point. Specifically, the 51Degrees integration was removed, which in turn, required removing the user interface that it used to do this very thing using point-and-click configuration options. Now, you can do this in numerous other ways, but they aren't as easy to do. Probably the easiest way to implement this would be one of the following two options: First, you can add a tiny bit of code to your theme and/or create a skin object that's added to your theme to detect and then redirect mobile visitors. You can grab a snippet from the SO link below. https://stackoverflow.com...its-mobile-or-tablet Next, there are redirect modules available in DNN Store that can help you do this via configurations. I'm not sure if there is an open source one that does this too. https://store.dnnsoftware...text=redirect+mobile
It's been a while since I used this so I did a bit of research. A. I see that a DNN 9 site still set a cookie on mobile devices (dnn_IsMobile).
[EDITED] You could use that to redirect using Javascript. Or you could add code to your skin to handle this. Our StyleHelper also has an option to redirect based on a cookie. (This would mean adding our skin object to your "Desktop" skin.)
<%@ Register TagPrefix="fortyfingers" TagName="STYLEHELPER" Src="~/DesktopModules/40Fingers/SkinObjects/StyleHelper/StyleHelper.ascx" %> RedirectName="Cookie" IfCookie="dnn_IsMobile:True" RedirectTo="/stylehelper-sko/redirects/redirect-mobile/mobile-landing" RedirectMode="always" runat="server" />
[/EDITED] B. Our StyleHelper Theme / Skin object ca also do Mobile (server) detection redirects. I had not used that part for a while and I just did a test and it all still seems to work. The logic is based on a regular expression, which you can replace to twaek if needed.
https://www.40fingers.net...ucts/DNN-Stylehelper
Examples (this would need to be added to your Theme after you install the Skin Object)
<%@ Register TagPrefix="fortyfingers" TagName="STYLEHELPER" Src="~/DesktopModules/40Fingers/SkinObjects/StyleHelper/StyleHelper.ascx" %> ID="STYLERHELPER2" IfMobile="true" RedirectTo="/stylehelper-sko/redirects/redirect-mobile/mobile-landing" RedirectMode="session" RedirectedInfo="Cookie,QS" runat="server" />
OR custom regex:
<%@ Register TagPrefix="fortyfingers" TagName="STYLEHELPER" Src="~/DesktopModules/40Fingers/SkinObjects/StyleHelper/StyleHelper.ascx" %> RedirectName="Custom" IfMobile="true" RedirectTo="/stylehelper-sko/redirects/redirect-mobile/mobile-landing" RedirectMode="always" RedirectedInfo="Cookie,QS" DetectMobileRegex1="Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune" DetectMobileRegex2="" runat="server" />
FYI, I just released a new version of the Style Helper (02.12.01) , fixing some smaller issues I found during testing, if you used it before, please upgrade. :-)
Posted By Timo Breumelhof on 26 Jun 2019 06:22 AM FYI, I just released a new version of the Style Helper (02.12.01) , fixing some smaller issues I found during testing, if you used it before, please upgrade. :-)
So much better of an answer, Timo! I sometimes forget about the StyleHelper skin object. :)
Ok, it's resolved.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.