Forum Moderators: open
(example:
Full URL:
htpp://www.sitename.com/articles/article1.html)
Can this may be done by javascript?
I tried and I can't do it.
It is to be similar as when the page was created, etc.
(proprieties of page, but with the full address as it appears on the browser).
Can anyone help me?
Thank You.
Arruda, Joseph
Now, one more question (if you can help me).
There's any way to record the «result» that is showed in the proper page?
I explain. With the script, the page appears like this:
«The url for quotation is www.name.com/file.html»
But, if anyone save the page to a file in the hard disk, it copies the script command and when the person run the file, it will appear «The url for quotation is file C:/example/file.html». There are any way that in the file saved it appear the real URL from where the page was saved (www.name.com/file.html)?
Thanks
Arruda.
document.write("www.mysite.com/page.html");
Then again if you are doing that you may as well just write the page name using HTML :)
But it is to much for my acknowledge about javascript. Can it be possible to adapt that option in saving the results of a javascript action?
Thank you.
Arruda.
Silly idea for you.
< amended since first posted.
I have just thought of a better idea. I'll leave this here because it meets sillyness requirements. >
When a document is saved in IE using "Web Page, complete" (not "Web Page, HTML only"), then you will find this in the source code (for eg):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0046)http://www.webmasterworld.com/forum91/2291.htm --> We can grab that string in the comment, and mess with it until we have the URL in a variable:
[pre]
<script>var URL = getCommentURL()
// If URL returned,
// write it into a link, for instance
if(URL)
document.write(
"<< <a href=\"" +URL+ "\">" +URL+ "</a> >>"
)
//
function getCommentURL()
{
// get the first comment node's text
// In IE, this is all: from <!-- to -->
var comm = document.getElementsByTagName("!")[0]
// if no comments, stop
if(!comm) return null
var text = comm.text
//grab the bit from where the url starts, to the end
var URL = text.substring(text.indexOf("http"),text.lastIndexOf(" "))
// return the URL
return URL
}
</script>
[/pre] This function can be safely put, or linked into the <head> section, since the comment is always at the top, below the <DOCTYPE>,
so it has always loaded before the script is executed.