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 3606746
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:17:17+00:00 2026-05-18T21:17:17+00:00

I have an iPhone web application that creates a meta viewport tag dynamically, using

  • 0

I have an iPhone web application that creates a “meta viewport” tag dynamically, using Javascript, depending on certain user-configured settings.

I want to provide a default meta viewport tag in case Javascript is disabled, but can’t find a proper way to do it.

I tried this:

<noscript>
<meta name="viewport" content="initial-scale=1.0">
</noscript>

And it does work, however it does not seem to be valid, as noscript is apparently not allowed in the HEAD section of an HTML document (I also looked at this question)

Any alternatives?

Edit:

I already tried having a default meta viewport tag, then removing (or replacing) it with Javascript. This “almost” works: You can indeed modify an existing viewport meta tag with Javascript (the technique is well described here). However there are some limitations: While you can modify the value of a given property, you can NOT make the device “forget” (reset to default value) a property that has already been defined. Also, simply removing the meta tag with Javascript doesn’t work.

  • 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-05-18T21:17:18+00:00Added an answer on May 18, 2026 at 9:17 pm

    Tricky.

    Have you tried

    <meta name="viewport" content="initial-scale=1.0">
    
    <script>
    document.write('<meta name="viewport" content="initial-scale=2.0">');
    </script>
    

    ? (2.0 being the scale than you would want to set if scripting is enabled)

    I can’t find any binding info on whether this is legal, but it seems to be in HTML. The question is whether it’ll be parsed correctly.

    Other than that, I can think of only two alternatives:

    • Detecting Javascript support on server side, and serving two different pages, one with, one without the meta tag

    • Always embedding the viewport tag, and removing it using Javascript – I have no idea whether this’ll work, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a web application for mobile phones that uses JavaScript Google API.
I have an iPhone application with a settings.bundle that handles various settings for my
I have a web application that relies on a MySQL database, for which I
I have an idea for a web application that would be great if it
I'm working on a web application that will have a custom UI for the
I have web application that uses JasperReports for PDF report generation. I'd like to
I have an iPhone application where i'm showing a settings page using modal view
I have loaded google map application in iphone . I am using UIWebView Control
I have an iPhone app that hides the status bar. However, my main view
I have an iPhone app that compiles and runs fine in the Simulator on

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.