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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:58:54+00:00 2026-05-20T05:58:54+00:00

I want to serve up a different stylesheet if my app is loaded within

  • 0

I want to serve up a different stylesheet if my app is loaded within an iframe. What JavaScript event do I use to do this check, and how do I serve up the different stylesheet?

EDIT:

I tried wiring this to the body onLoad event:

<script type="text/javascript">
    function checkFrame() {
        if (window.top!=window.self)
        {
            // In a Frame or IFrame
            document.write("<link rel='stylesheet' type='text/css' href='/custom/embedded'>");
        }
        else
        {
            // Not in a frame
            document.write("<link rel='stylesheet' type='text/css' href='/custom/standard'>");
        }
    }
</script>

but it displays a blank page only the stylesheet link in it.

  • 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-20T05:58:55+00:00Added an answer on May 20, 2026 at 5:58 am

    Here’s what I ended up doing, in jQuery. I was overcomplicating it.

    $(function() {
    
        if (window.top!=window.self) {
            // my css switcher
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to serve different javascript files depending on if browser supports CSS3 transition
I have this code down here. When format.js fires I want to serve to
I have a model and I want to allow users to edit different subsets
I want to serve up specialized RSS feeds on a different subdomain from the
I want to serve different content types based on the Accept header I receive
I've tried to do this in several different forms and this is just the
I have a variety of functions within my models which serve a different purpose.
My app project contains several helper classes that serve all kind of different purposes
I want to use the following jQuery dialog box for to open different popup
I want to serve my JavaScript scripts from a CDN like cloudflare. Now my

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.