Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8183525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:11:14+00:00 2026-06-07T01:11:14+00:00

i added this to the head of my page: <script type=text/javascript> if (screen.width <=

  • 0

i added this to the head of my page:

<script type="text/javascript">

if (screen.width <= 800) {
    window.location = "http://m.domain.com";
}

</script>

i have a button on my mobile version called “Main Site”.
I want the button to go to my main site, but not redirect back to my mobile site. How do i do this?

also, i only want them to go there once. So, the next time they enter my website name, i want it to take them to mobile site

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:11:15+00:00Added an answer on June 7, 2026 at 1:11 am

    If you already have a button to go your main site. Just link the main site to that button. What you can do extra is, use an url parameter to check and force the main layout. Something like

    <a href="http://www.domain.com?forcelayout=main">Main site</a>
    

    Check for this parameter, when you want to force the main layout. Or else, the script currently using will automatically do what you want to do.


    Use the following function to read the query string. [Source]

    function getParameterByName(name) {
        var match = RegExp('[?&]' + name + '=([^&]*)')
                        .exec(window.location.search);
        return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
    }
    

    Next you can use it in your logic, like this:

    if (screen.width <= 800 && getParameterByName('forceLayout') != 'main') {
        window.location = "http://m.domain.com";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

BEFORE CHAOS I used to have this one... at the head part <script type=text/javascript>$(function()
<html> <head> <title>Testing AJAX</title> <script type=text/javascript src=//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js></script> <script> function init() { $(#form1).submit(submitForm); } function
I'm trying to add upload controls to the page. This HTML mark-up with JavaScript
I'm adding some <script> tags dynamically to the head element after page load. I
I have a web page with a Javascript file added dynamically. After changing the
OK guys this is intreting, I'm testing this page http://static.nemesisdesign.net/demos/ie8-strange/test.html on IE8 / windows
I've got a javascript file being added dynamically to a page. If I use
I added this part of the code in my onCreate() method and it crashes
I have added this fix https://gist.github.com/2382288 for protect all fields against mass assignment in
I just added this to my web.xml on my JBOSS server. But it had

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.