Redirect to mobile site link
I am wondering how I can make a link that only displays on mobile browsers to redirect users to the mobile site.
For example. I have users redirected to the mobile site, but if they want to go to the regular site, I have a link at the bottom of the page to redirect them to the desktop site using the link ?m=false
Now I would like a link that says ?m=true but only shows up for a mobile user. Is there any way to do that in contao? Or should I use some javascript?
Re: Redirect to mobile site link
I do not know about preventing the html. Contao adds classnames that identify platform and browser. You could use those to hide the link.
Doesn't any extension help you with this?
Re: Redirect to mobile site link
I've looked through all the extensions, I couldn't seem to find any that would help me with this... I suppose I could try using classnames... Though this coming week I am going to visit someone who knows a lot more than I do, so hopefully we can come up with some javascript...
Though one other thing and it doesn't seem to be there and I think it should, but an option to disable the redirect for the mobile users, because I would like tablet devices to just go to the main site and just have mobile devices get redirected... would save me a lot of time...
Re: Redirect to mobile site link
Actually I meant hiding the link using CSS. Suppose the link has id="mobileLink", you'd say in your css
Code:
.win #mobileLink, .mac #mobileLink, .linux #mobileLink { display: none; }
I'm not sure about the correct classnames, there should be a list.
Re: Redirect to mobile site link
Thanks, I looked them up with my friend and we used some javascript to hide it... Works great... :)
Re: Redirect to mobile site link
As a comment I'd like to add you should really not use javascript when an easy CSS solution does the exact same. Did you try my solution, and what part did not work for you?