Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Coding for Netscape and IE 3

Status
Not open for further replies.

piratefan

Programmer
Jul 20, 2003
195
US
I have a website that looks okay(to me anyway) in IE. However, in Navigator, it is not at all acceptable. I am very new at xhtml and have a few questions maybe somebody can help me with.

First of all, I have read about a tool, html-kit. Would this kind of utility be useful in coding in such a way that the pages would look decent in both browsers? I am lost as to how to make my code work in Navigator.

Thanks. Merry Christmas.

John
 
John...

Learn how to write standards compliant code.

While I realise not every browser is 100% compliant, this will get your code working most of the time. You then have to learn the quirks and how to code around them for each specific instance of browser/OS.

I doubt you will find a tool anywhere that will modify your code to work in all browsers in the same way.

Jeff
 
How did you go about creating your site? That may be part of the problem. I don't know if html-kit will help you generate a site that works in IE and Netscape, but it may do a better job than what you'r currently using.

As BabyJeffy said, make sure your code is standards-compliant. You can test your code's compliancy with W3C's html validator:
Also, check out sites like and for some great tips.

I would also recommend downloading Mozilla and installing the DevEdge sidebar, which gives you easy access to CSS and HTML specifications that you can use as a reference. Mozilla also comes with the DOM inspector that is a great help in debugging your site.
 
Thank you very much for the great advice. To answer your question about what I did my sites in, you probably never heard of it.

I created my first site using a tool called Web Matrix. It is for asp.net coding. I knew nothing of dynamic web pages and this thing was free. So I perservered and got it up using this.

I then did another site that has just static pages but used this thing again. Probably not too bright. I cached the pages bigtime, I figure to cut down on wear and tear on the server.

It's time for me to learn how to do things the right way. I really like this stuff, and even though I ain't no spring chicken, this is what I would like to do to finish up my life, so to speak.

Thanks again.
 
Can you tell me how or if I can use validator for dynamic pages? The site I am submitting to it was done with asp.net. I get a message about lacking a Document declaration.
Thanks for any help.
John
 
When the pages are served to the customer (or the validator) their dynamic content was already parsed by the server, thus they receive a static page. Meaning yes, dynamic pages can be validated the same as static.

On your problem, the first thing you need to specify when creating a page it is the set of rules which your page will follow. This is called a Document Type Declaration or DOCTYPE for short. What you do is point your page to a declaration at the w3c server which checks which elements and attributes it can use and which to ignore.

First thing you need to do is decide between HTML (less strict) or XHTML (more strict). They are the same languages, the difference is in the strictness. With both you will face additional options in Transitional (less strict) and Strict (more strict). Consult the for complete information on the DOCTYPES. Here's a short example:

<DIV id=container><img src=&quot;...&quot; alt=&quot;&quot; border=&quot;0&quot; /><br></DIV>

in HTML 4.01 this code would probably validate.
in XHTML Transitional this would not validate yielding the following errors: capital letters for element name and attributes (only small letters are allowed in XHTML), no quotes for id attribute (all attributes have to be &quot;double-quoted&quot;), tags not closed (ALL tags have to be closed in XHTML even single ones - <br />)
in XHTML Strict in addition to Transitional errors, border=&quot;0&quot; is not a valid attribute for the img and would be ignored.

Hope it helps.
 
I think I may get an education here. My asp.net pages have no mention of DOCTYPE on them. The texts I have give no example of any page with anything other than asp.net declarations at the top. Imports etc. I assume I have to add the DOCTYPE for the html to be recognized correctly? I am even wondering how any browser knows how to interpret the code as is. Without a DOCTYPE.
Sorry if a simple question. Thanks.
I have looked at the W3c site. I don't see anything that covers this.
 
I did a search on the W3C web site for doctype and found this:
Sometimes adding the correct doctype can 'fix' your pages, which may be the case with your site and Navigator. However, I'm not familiar with Web Matrix or even ASP so figuring out how to get the correct doctype to show up on your pages is beyond me.

If you really want to learn how to write web pages, you should start coding them by hand. This is how I've been doing it and you tend to learn quite a bit this way. There are tons of resources on the web for learning (x)html and css, but one good place to start is .
 
Code them by hand is exactly what I want to learn to do. I was pressed for time to create the site I did with Web Matrix. Now I am just pressed for time to get a job. But I really like doing this. I will take you up on your advice. These forums are incredible. It took me months to make the first site with those dynamic pages. I knew squat about anything. I just kept reading texts and visiting forums. Sometimes I wonder how I did it. Of course, seeing it with Navigator makes me think it wasn't a total success.
I will have to figure out how to get that DOCTYPE guy onto my asp.net pages. Then hopefully, I can do the validator guy and see what the heck my problem could be.
Once again, thanks for all the help.
John
 
The browsers parse the page with their own built-in interpreters. Declaring a DOCTYPE can force a non-standards browser (such as IE) to conform to standards. Basically, declaring your DOCTYPE will make your pages look the same on all browsers (or at least more similar), but you have to realize that they will look more like the Netscape (or Mozilla or Opera) versions than the IE versions. That happens because those browsers are using standards compliant interpreters while IE does not. But ultimatelly, coding within the standards will make your pages look nicer across all browsers and your code better. Here you can check how to specify DOCTYPE for an XHTML document:


and for the HTML

(just browse the pages further info on other doctypes)

Remember that the doctype tag is the first tag (comes right before <html>) in a html (or .asp or .aspx or .php or whatever) file and that it is the only tag that is not closed. Hope it helps.
 
>> Remember that the doctype tag is the first tag (comes right before <html>) in a html (or .asp or .aspx or .php or whatever) file...

This is not always the case. For example, for an ASP file, you would most likely have your ASP language declaration as the first line, not your HTML DTD, which would come further down the page:

Code:
<%@ Language=JavaScript%>
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;[URL unfurl="true"]http://www.w3.org/TR/html4/strict.dtd&quot;>[/URL]
<HTML LANG=&quot;EN&quot;>
<HEAD>
... etc ...

Dan
 
Thank you very much guys. I am very eager to learn this.
 
I know that in server side scripting you can (and usually do) use some code above the doctype declaration, but the doctype is the first rendered (printed) line.
 
Once again, thanks. I am learning. Slowly, but ah, learning.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top