.html not recognized - MAC OS 10.5/Safari default browser

K

kquirici

Hi,

This is a frustrating problem with probably an easy solution.
I'm cross-posting to a MAC group also.

I'm on MAC OS 10.5. I have Safari set up as my default
web browser.

When I save a web page to my desktop and
double-click it, it pops up in the Safari browser
as one would expect.

However when I try to double-click an html I've created myself
called kmq1.html. it brings up a text editor.

But if I choose the option (from right-clicking the file icon)
it opens in Safari fine.

Why isn't my html recognized? The icon for the file is
the standard html icon.

Thanks.

Ken

----Here's the html. It's simple enuf.

<!DOCTYPE HTML PUBLIC "-//W3C//DD HTML 4.0 Transitional//EN" >
<html lang=”en-US”>
<head>
<title>Title of page</title>
<h3>This is h3</h3>
<h2>This is h2</h2>
<h1>This is h1</h1>
<h4>This is h4</h4>
<hr><br>
<br>
<!— This is a comment —>
<! This is a comment >
<! This is a comment />
<h5>This is h5</h5>
<h1>This is h1</h1>
<p>this is a paragraph<br>with a break in the heading <br>area</p>
</head>
<hr>
<body>
This is my first homepage. <b>This text is bold</b>
<p>this is a paragraph in the body </p>
<a name=”targetx1”>heres the target of the link in kmq5.html</a>
<p>
how can this possibly work?
</p>
</body>
<hr>
</html>
 
D

David

Hi,

This is a frustrating problem with probably an easy solution.
I'm cross-posting to a MAC group also.

I'm on MAC OS 10.5. I have Safari set up as my default
web browser.

When I save a web page to my desktop and
double-click it, it pops up in the Safari browser
as one would expect.

However when I try to double-click an html I've created myself
called kmq1.html. it brings up a text editor.

But if I choose the option (from right-clicking the file icon)
it opens in Safari fine.

Why isn't my html recognized? The icon for the file is
the standard html icon.

Thanks.

Ken

----Here's the html. It's simple enuf.

<!DOCTYPE HTML PUBLIC "-//W3C//DD HTML 4.0 Transitional//EN" >
<html lang=”en-US”>
<head>
<title>Title of page</title>
<h3>This is h3</h3>
<h2>This is h2</h2>
<h1>This is h1</h1>
<h4>This is h4</h4>
<hr><br>
<br>
<!— This is a comment —>
<! This is a comment >
<! This is a comment />
<h5>This is h5</h5>
<h1>This is h1</h1>
<p>this is a paragraph<br>with a break in the heading <br>area</p>
</head>
I would move this head to the top
<hr>
<body>
This is my first homepage. <b>This text is bold</b>
<p>this is a paragraph in the body </p>
<a name=”targetx1”>heres the target of the link in kmq5.html</a>
<p>
how can this possibly work?
</p>
</body>
<hr>
</html>

The rest of the page looks fine for now. The problem isn't with your
html file but rather the file association within your OS/10.5. Do the
following to change it:

Select one of the files in Finder, then do apple-i. This is Get Info,
and brings up a property sheet on the file. In that window you should
see a section named "Open With". Choose Safari or whatever.

I Hope this is of some help.

Cheers
 
D

David

Ari said:
Remove any content outside body, hr in this case.
That is correct. I missed that part of the code. But that isn't the
problem. I hope the file association within that file and the OS 10.5
will fix his problem.

Good eye there with the <hr> outside of the <body> tag.

Cheers
 
G

Gus Richter

----Here's the html. It's simple enuf.

Simple and yet full of basic errors.

You should not be using a Transitional Doctype and you should be using
html 4.01 instead of html 4.0
All new documents should be using a STRICT Doctype Declaration.
Use this one:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

You have illegal elements in the head section.
The only permissable items in the head section are comments and the
following elements:
script, style, meta, link, object, title and base
In your example, the only line in the head section should be:
<title>Title of page</title>
The rest should be in the body section.

Anything between the closing head tag and opening body tag is illegal. i.e.
</head>
<hr>
<body>
Anything between the closing body tag and closing html tag is illegal.
</body>
<hr>
</html>
Both of the <hr> should be in the body section.

Your 3 comment versions are wrong. Only this one is correct:
<!-- Only this is a comment -->

I recommend some reading of:
<http://www.w3.org/TR/html4/>
Further reading recommended:
<http://www.w3.org/TR/CSS21/>
 
D

dorayme

I'm on MAC OS 10.5. I have Safari set up as my default
web browser.

When I save a web page to my desktop and
double-click it, it pops up in the Safari browser
as one would expect.

However when I try to double-click an html I've created myself
called kmq1.html. it brings up a text editor.

But if I choose the option (from right-clicking the file icon)
it opens in Safari fine.

Why isn't my html recognized? The icon for the file is
the standard html icon.

To the last first: because it is normally a good idea to have it open in
your favourite text editor. You can choose which program to open such
files (including your favourite text editor)

1. Highlight file,

2. File/Get Info or Command + I or, in column directory view, click the
More info button or even try control or right click to get a context
menu and chose Get Info (so many ways!)

3. Go down to the "Open with" and click arrow to reveal options

4. Use scroll menu with little arrows to *Choose* the prgm you want

5. Make sure you then press the Change All button under the words "Use
this application to open all documents like this"

Perhaps you don't know that simply dragging the file icon or name over
any browser icon or even over any open browser window (under most
circumstances - does not work if you are viewing a pdf in your browser
window!) makes the file produce a webpage.

What program you choose to open in as default depends on your work. It
is natural and rather more reasonable for a website developer to have
double click open it in a text editor so he can edit and/or inspect the
code straight away.

Yes, you could choose as default a browser, and when wanting to edit,
you could then drag file over a text editor or use the Get Info panel
and Open With *without* pressing the Change All button.

But the two strategies are not quite symmetrical or as convenient as
each other. Here is one reason: if it opens in a browser and then you
want to edit, you can inspect the source via View Source menu item but
then you cannot edit.

True, you could then open the source by returning to the file and
opening it as a one off special in a text editor or by dragging to a
text editor icon.

Here are some other things that might assist you to know. In iCab, you
can set your own text editor to View Source so you could have best of
both worlds by opening as default in iCab and a simple Command + 8 will
get you the file open in your favourite editor. But that is iCab, not
Safari.

By the same token, some editors have the mirror capacity to this last.
In BBEdit, for example, you can set the browsers you want the file to
display as web page in and there are buttons and things to make this
easy.

Do what you find easiest for your situation. You might well find it more
convenient to have double click open the text editor and use many other
simple means for opening in browsers rather than the other way around
when you have a lot of website work to do.

For one thing, you tend to use one editor but many browsers!
 
D

David

David said:
Select one of the files in Finder, then do apple-i. This is Get Info,
and brings up a property sheet on the file. In that window you should
see a section named "Open With". Choose Safari or whatever.

I Hope this is of some help.

Cheers
Hello there Ken,
I am glad you have figured out how to do this. But I just wanted to
point out that the first post regarding this issue solved the problem.

Even though your html wasn't perfect, it still would have displayed
something. The only thing that would cause an issue like this
is file -> application association.

It is correct though if you right click on a file on your desktop
or other places and choose open with - it will only do it once.
You have to press Apple I (more info) and change the application
association manually to keep it from doing that again.

Glad you got it all figured out.
By the way, what mac group were you working with?

Cheers
 
D

dorayme

Do what you find easiest for your situation. You might well find it more
convenient to have double click open the text editor and use many other
simple means for opening in browsers rather than the other way around
when you have a lot of website work to do.

Well you've presented the two strategies neatly.

Now I have to choose. Or not. :)[/QUOTE]

It is interesting to think what the not choosing might come down to in
practice? Perhaps it means leave things at default (which is what you
had before). But then, if it really means this, what is the difference
between choosing and not choosing? :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top