Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: goofy HTML addressing

Reply
Thread Tools

Re: goofy HTML addressing

 
 
Thomas Fritsch
Guest
Posts: n/a
 
      02-14-2006
Roedy Green wrote:

> In particular I refer to html URL relative addressing. It is fine to
> address members in the same directory, but falls on its nose to
> address a page elsewhere in the tree. If a page is moved, all links
> in a page must be recalculated in a way that is highly error-prone.
>
> The same included HTML needs to be adjusted depending on where it is
> inserted to adjust all relative links.
>
> If a page moved, there is no simple way with search/replace to find
> and adjust all links in other pages to it.
>
>
> I make my adjustments with static macros, but the obvious solution is
> a third mode -- webroot relative addressing.
>
> I propose syntax like this
>
> href=":images/dog.png"
>
> means relative to the webroot which works for local or website
> browsing You can use that sane syntax to get at your linkages at any
> depth in the html document tree.

If you use
href="/images/dog.png"
you do have a link relative to the webroot. So what is the difference to
what you want to achieve? Or did I completely misunderstand you?


--
"Thomas:(E-Mail Removed)".replace(':', '.').replace('@', '$')
 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      02-15-2006
On Tue, 14 Feb 2006 19:34:11 GMT, Thomas Fritsch
<(E-Mail Removed)> wrote, quoted or indirectly quoted
someone who said :

>If you use
> href="/images/dog.png"
>you do have a link relative to the webroot. So what is the difference to
>what you want to achieve? Or did I completely misunderstand you?


but there is no such thing as a webroot locally when you are preparing
and viewing the files, or distributing them for offline use, right? It
would be lovely to be wrong on this one. I would kick myself for so
long spent wrestling with pure relative addresses.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
 
 
 
Thomas Fritsch
Guest
Posts: n/a
 
      02-15-2006
"Roedy Green" <(E-Mail Removed) > wrote:
> On Tue, 14 Feb 2006 19:34:11 GMT, Thomas Fritsch
> <(E-Mail Removed)> wrote, quoted or indirectly quoted
> someone who said :
>
>>If you use
>> href="/images/dog.png"
>>you do have a link relative to the webroot. So what is the difference to
>>what you want to achieve? Or did I completely misunderstand you?

>
> but there is no such thing as a webroot locally when you are preparing
> and viewing the files, or distributing them for offline use, right?


Suppose your HTML file is at URL "file://localhost/somedirectory/page.html"
and you have
href="/images/dog.png"
in it. Then this ref would expand to
href="file://localhost/images/dog.png"
That means: in this case your webroot is at "file://localhost/"

> It would be lovely to be wrong on this one. I would kick myself for so
> long spent wrestling with pure relative addresses.


--
"TFritsch$t-online:de".replace(':','.').replace('$','@')


 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      02-15-2006
On Wed, 15 Feb 2006 03:30:28 +0100, "Thomas Fritsch"
<(E-Mail Removed)> wrote, quoted or indirectly quoted
someone who said :

>Suppose your HTML file is at URL "file://localhost/somedirectory/page.html"
>and you have
> href="/images/dog.png"
>in it. Then this ref would expand to
> href="file://localhost/images/dog.png"
>That means: in this case your webroot is at "file://localhost/"


but that won`t be where the local file is. Each website you are
preparing lives in its own directory, not the root.

In my case for example I need href=":images/dog.png" inside file
E:\mindprod\jgloss\dalmatian.html to expand to
file://localhost/E:/mindprod/images/dog.png
when used locally
and
http://mindprod.com/images/dog.png
when used on the web.

You want true file urls rather than faked local websites with an HTTP
servec so that when you do view source you can edit the orginal.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
Thomas Fritsch
Guest
Posts: n/a
 
      02-15-2006
Roedy Green wrote:
> On Wed, 15 Feb 2006 03:30:28 +0100, "Thomas Fritsch" wrote:
>
>>Suppose your HTML file is at URL
>>"file://localhost/somedirectory/page.html" and you have
>> href="/images/dog.png"
>>in it. Then this ref would expand to
>> href="file://localhost/images/dog.png"
>>That means: in this case your webroot is at "file://localhost/"

>
> but that won`t be where the local file is. Each website you are
> preparing lives in its own directory, not the root.
>
> In my case for example I need href=":images/dog.png" inside file
> E:\mindprod\jgloss\dalmatian.html to expand to
> file://localhost/E:/mindprod/images/dog.png
> when used locally
> and
> http://mindprod.com/images/dog.png
> when used on the web.
>
> You want true file urls rather than faked local websites with an HTTP
> servec so that when you do view source you can edit the orginal.


Well, I must admit, the "file:"-URL technic is not very well-suited for
offline-testing web-sites.

One (probably very bad) way to get around this would be:
Instead of keeping your whole web-content in "E:\mindprod", keep it in "E:\"
or maybe in "C:\". Then the root "file:///" is, where it should be.

Another idea is:
Completely avoid offline-testing with "file:..." URLs. Instead set up a
HTTP-server on your local machine, and configure it to have "E:\mindprod\"
as its web-root, and to listen at "localhost".
Test your offline-site with "http://localhost/...." URLs. When your browser
sees href="/images/dog.png" in your HTML, it will request
"http://localhost/images/dog.png", and your local server will respond with
the contents of "E:\mindprod\images\dog.png".
You know that you won't need a full-featured server like Apache. Any small
toy web-server will do. (Google for example for "Tiny HTTPd in Java")

--
"Thomas:Fritsch$ops.de".replace(':', '.').replace('$', '@')
 
Reply With Quote
 
Timo Stamm
Guest
Posts: n/a
 
      02-15-2006
Thomas Fritsch schrieb:
> Well, I must admit, the "file:"-URL technic is not very well-suited for
> offline-testing web-sites.



It definitely isn't. Just think about content types.


> Instead set up a HTTP-server on your local machine


ACK.


Timo
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      02-16-2006
On Wed, 15 Feb 2006 16:42:44 GMT, Thomas Fritsch
<(E-Mail Removed)> wrote, quoted or indirectly quoted
someone who said :

>Completely avoid offline-testing with "file:..." URLs. Instead set up a
>HTTP-server on your local machine, and configure it to have "E:\mindprod\"
>as its web-root, and to listen at "localhost".


The problem with that approach is view source does not work. You are
using the links to find the stuff you need to update. With a local
server you don't get the original do you?

I thought perhaps a clever editor that would render, edit and navigate
links could be taught to reinterpret absolute links locally. However,
than leaves out in the cold my users who want to peruse the website
offsite from a local mirror.

The problem does not have an elegant solution. Perhaps that is why
W3C backed away from it.

Consider the this scenario. You are using google desktop to index
your local files. You parachute into to a file

E:\mindprod\jgloss\jar.html and it has a reference to :image\jar.png

How is the browser to know that really means
E:\mindprod\images\jgloss\jar.png rather than
E:\images\jgloss\jar.png
?

Ok, let's say W3C were to invent a header tag called local base
set to E:/mindprod all is fine, right?
until somebody downloads the site and puts it in
F:/mymirrors/mp

So I think the solution is:

1. You use a tag of the form ":images/jar.png" which is interpreted
as webroot relative both on the website and locally.

2. To help with the translation from webroot to absolute locally, you
must register a set of webroots in your browser, and the browser
selects the best/only fit.

I suppose I could try to introduce this idea into the world purely as
a browser convenience feature. Then I don't need W3C approval.
I have to sell it to browser makers a few at a time, and hope the
natuar0l use of it forces the others to support it too.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
keyboard getting goofy g Computer Support 8 07-13-2010 04:57 PM
goofy global.asa Giorgio ASP .Net 8 01-29-2007 05:28 AM
Re: goofy HTML addressing yangc Java 2 02-17-2006 05:04 AM
Re: goofy HTML addressing Thomas Hawtin Java 5 02-16-2006 03:22 PM
Outlook Express is goofy Don Jennings Computer Support 3 06-06-2005 08:42 PM



Advertisments