MyBB Community Forums

Full Version: How can i achieve this?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Althou my website is still work in progress i want to make a mobile version of it. Most of it will be just CSS and a bit of HTML, but the problem is that i don't use templates like mybb does so it's all a lot of HTML in all of my files and i don't want to edit every page to add an if condition to switch between mobile and standard.

How do i make so switch to my mobile website without redirecting to a different folder yet not modifying every page to display mobile content?

There are a few themes out there for mobile use that include plugins that will auto-redirect. You can also just get the plugin.
The question was non-mybb related. I was just using it as an example.
Oh well you just need to get a regex and put it into the <head> of an HTML page.

For example, if you want to redirect iPhone, iPod, iPad users then you use this:
<script type="text/javascript">
if ((navigator.userAgent.indexOf('iPhone') != -1) ||  
(navigator.userAgent.indexOf('iPod') != -1)) {  
document.location = "/Location of iPhone Website/";  
}
</script>

Of course there are probably universal regex's that will work for all mobiles but if you wanted specific device sites then you use things like that.
The redirection part is not the problem. It's how to display the proper html and css for a mobile device without having to edit my layout with lot's of if/else conditions.
Just do some simple HTML/CSS look at m.facebook.com in you're browser for a example.

There are some exact sizes for certain devices.