You are here: Re: HTML to generate "this" URL « HTML « IT news, forums, messages
Re: HTML to generate "this" URL

Posted by Mitja Trampus on 11/17/05 23:37

David Blickstein wrote:
> Is there a way in HTML to generate the URL of "this" page. I have a page
> which moves around a lot and happens to be co-located with stuff that people
> need to copy the URL of into an installation.
>
> I'd rather have it just print the URL rather than awkward text that says
> "take the URL of this page and..."

Just HTML, no. With javascript, yes, but make sure you don't
make javascript a neccessity for understanding the
instructions because it can be disabled.

Do something like:
<body onload="updateContentsOfLocalUrlSpanWithCurrentUrl()">
<p>
Take the URL of this page (<span id="localUrl">copy-paste
from address bar</span>) and do foo with it.
</p>

The JS function you need is simple, an one-liner:
document.getElementById("localUrl").innerHTML = location.href
Note that this piece of JS is far from perfect (regarding
cross-browser issues), but I'm not exactly an expert on that.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация