Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Hack Management for CSS skins & IE7 problemsHack Management for CSS skins & IE7 problems
Previous
 
Next
New Post
1/20/2006 10:59 AM
 
Yes, works like a charm. Firefox displays correctly and so do the different versions of IE.

Could you explain how the Javascript works so that only IE reads it? When I find a solution I like to understand how it works...

Many thanks for your help,

Lee Sykes - DNN Creative Magazine - 600+ Video Tutorials, Articles, Interviews - July Issue 58 out now!
DNN Creative Magazine for DotNetNuke

Twitter: www.twitter.com/DNNCreative

Lee Sykes's Facebook Profile
 
New Post
1/20/2006 11:04 AM
 

Typically, you handle browser detection on the server side by checking the user agent. Client-side, it's much easier...just test for the availability of an object or method using if (object) ... or if (method) test. Knowing that certain objects and methods are available only on certain browsers, this is a quick and easy way to implement conditional code.

In this situation, the document.createStyleSheet() is specific to IE, so testing for it before calling the method to inject the spreadsheet has the exact same effect as the conditional hack.

Before document.getElementById() became a standard, you would see a lot of code with document.all() or document.layers() to test if a browser is IE or Netscape. Same concept applied to stylesheets.

Nik

 


Nik Kalyani
Co-founder
DotNetNuke Corporation
Blog | Twitter | FaceBook
 
New Post
1/20/2006 11:15 AM
 
Great, that makes much more sense. I've been doing a bit more hunting around with Hacks, IE7 etc. and come across this website: http://dean.edwards.name/IE7/intro/

Basically the idea is to fix the IE browsers below IE7 and bring them up to the IE7 level by calling up some javascript code. - It's still in alpha testing, but it sounds pretty interesting.

Cheers,

Lee Sykes - DNN Creative Magazine - 600+ Video Tutorials, Articles, Interviews - July Issue 58 out now!
DNN Creative Magazine for DotNetNuke

Twitter: www.twitter.com/DNNCreative

Lee Sykes's Facebook Profile
 
New Post
1/30/2006 3:41 PM
 
Hi Nik,

Thanks for your previous help, I've now created a complete CSS based skin which you can view here:

http://skins.dnncreative.com

I've also created a print.css file which is called up when a user presses print which uses a different layout suitable for printing. - I've tested the file by linking to it directly in the default.aspx file which works correctly, but now I need to edit the Javascript that you provided to add the following link:

link rel="stylesheet" type="text/css" href="print.css" media="print"

I tried this by adding the details using the commented code that you supplied but it doesn't work, I suspect I'm not using the code correctly. - Could you provide any pointers please?

if (document.createStyleSheet)
    document.createStyleSheet("<%= SkinPath %>/iehacks.css");
else
{
var styles = "@import url('<%= SkinPath %>/print.css');";
 var newStyleSheet=document.createElement("link");
 newStyleSheet.rel="stylesheet";
 newStyleSheet.href="data:text/css,"+escape(styles);
 newStyleSheet.media="print";
 document.getElementsByTagName("head")[0].appendChild(newStyleSheet);
}

Many thanks,

Lee


Lee Sykes - DNN Creative Magazine - 600+ Video Tutorials, Articles, Interviews - July Issue 58 out now!
DNN Creative Magazine for DotNetNuke

Twitter: www.twitter.com/DNNCreative

Lee Sykes's Facebook Profile
 
New Post
1/31/2006 3:27 AM
 
Lee,

You could also use an injector to inject the stylesheet in the head section of the page. There are different versions floating around. Some free some you can buy on snow. Unfortunately I can't find a reference to the free ones. Searching snow for injector will give you some hits.

Peter

Peter Schotman
Cestus Websites voor DotNetNuke oplossingen in Nederland
Contact us for your custom design and skinning work.
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...Hack Management for CSS skins & IE7 problemsHack Management for CSS skins & IE7 problems


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out