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

  • SEARCH
  • Home
  • 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 7011703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:09:39+00:00 2026-05-27T22:09:39+00:00

Firstly, I’ve done some Google’ing and found the IE ‘conditional comment’ and understand it’s

  • 0

Firstly, I’ve done some Google’ing and found the IE ‘conditional comment’ and understand it’s non-standard. I also get the impression there is no standard HTML ‘IF’ so my question is about what I need to do to achieve the same effect (Javascript perhaps?)…

I’d like to conditionally include an external .html file (from a selection of external .html files). Specifically, the external files each contains nothing but a <meta> element on a single line. Alternatively is it possible to have multiple inline <meta> elements in a HTML file and to ‘choose’ one conditionally (effectively ignoring the others)?

Basically, can I do something that would achieve the same as one of either of these pseudo code examples?

Example using pseudo code for external files…

<html>
    <head>
        if some-condition
            <!--#include file="meta1.html" -->
        else
            <!--#include file="meta2.html" -->
        ...
    </head>
     ...
</html>

Alternative example (again pseudo code) for selecting alternative elements directly…

<html>
    <head>
        if some-condition
            <meta name="viewport" content="abc" />
        else
            <meta name="viewport" content="def" />
        ...
    </head>
     ...
</html>

NOTE: In all cases the <meta name attribute will always be viewport – it’s just the content attribute which needs changing perhaps with some other attributes.

EDIT: The main condition would be the type of client. One example is that to help correctly size web app pages on an Android device you can use certain content data for the viewport that only Android devices understand. For conventional browsers, I would set a default set of data for content (for width/height for example). This could also be expanded for other clients such as Google TV, iOS etc etc.

  • 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-27T22:09:39+00:00Added an answer on May 27, 2026 at 10:09 pm

    Using Javascript:

    document.head.insertAdjacentHTML( 'beforeEnd', '<meta name="viewport" content="abc" />' );
    

    Demo: http://jsfiddle.net/ThinkingStiff/ccX5p/

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

Sidebar

Related Questions

Firstly, I'm some what new to C++/CLI . After doing some research I've found
Firstly, I was wondering if there was some kind of built in function that
Firstly, I have search Stack Overflow for the answer, but I have not found
Firstly, I have found many examples of how to grab data from a db
Firstly I tried fiding some similar posts but could not quite find anything. Mainly
Firstly anyone else trying to get onto forum.hibernate.org. I have been trying for a
Firstly, there have some tag links in my main page. click each one, post
Firstly, I've read through the posts with matching names, and I've tried integrating some
Firstly i have created a sequence in oracle in perl script.I get a error
Firstly, I'll explain the situation I'm in with my applicaton before I get onto

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.