SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Sep 2010
    Location
    Shanghai, China
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [discussion]css security issue

    How to prevent thirty-party css code from damaging my own page style?

    My Case condition:
    1. Page's style can be customized by third-party css code
    2. Page has its own private section which doesn't allow other code modify its style.

    For example:

    Page may like this:
    <div class="page"><div class="other"></div><div class=".psm"><h2></h2></div></div>

    Thirty party code may like this:
    .page{ color: red;}
    .page h2{color: blue; font-size: 100px;} /* danger: it will influence the .psm h2 which is a private section */

    So, how to provide a way to satisfy above two condition? which means letting
    thirty-party css code customize all page content but the private section?

    Any ideas?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    You could place the private section in an iframe. That would protect it from other CSS declarations on the page.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Sep 2010
    Location
    Shanghai, China
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    You could place the private section in an iframe. That would protect it from other CSS declarations on the page.
    iframe solution will have js issue. For private section is owned by system, which should have the whole permission to the system data or server action.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Well apart from that, perhaps people in the CSS forum might have some ideas.

    They might know if namespacing or other techniques are available, or unique class names may be the only other option.

    You can't be the only one to face your issue. Are there others developing in a similar nature to you who have already faced and solved your same dilemma?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Member
    Join Date
    Sep 2010
    Location
    Shanghai, China
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    Well apart from that, perhaps people in the CSS forum might have some ideas.

    They might know if namespacing or other techniques are available, or unique class names may be the only other option.

    You can't be the only one to face your issue. Are there others developing in a similar nature to you who have already faced and solved your same dilemma?
    Paul, Thanks for your suggestion!

  6. #6
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,096
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Thread continued in the CSS forum: http://www.sitepoint.com/forums/css-...ue-741897.html

    Thread closed.
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •