Anchor element doesn't work with full path

  • Thread starter Thread starter AAaron123
  • Start date Start date
A

AAaron123

<a
href="JavaScript:openWindow('Aerial','Images/Aerial-View.jpg',900+80,698+80)">Aerial
view of the grounds</a>

<a href="JavaScript:openWindow('Aerial','I:/My Documents/Visual Studio
2008/WebSites/Louis/Images/Aerial-View.jpg',900+80,698+80)">Test Aerial view
of the grounds</a>



The first one works OK.



The second one produces the small square with a square, circle and triangle
inside. Guess that means the image is not being displayed.

I'm quite sure there is no typo in the second path because I use windows
explorer to find the file and then cut and pasted the path.

The lines are next to each other in the markup just as shown above.



Can you explain that?



Thanks
 
openWindow() can not access the local client machine file system (unless
full trust is set and security modified). it should a url on the server.


-- bruce (sqlwork.com)
 
openWindow is just a JavaScript function.
So the question boils down to:
Why does a function work OK when I call it with:
'Images/Aerial-View.jpg'
But not when I call it with the full path :
'I:/My Documents/Visual Studio ...

If JavaScript had the equivalent of ~ client side I think I'd be all set.
Of if I could set a Session variable equal to ~ I think I'd be all set.

I think I could use something like:
<img src="http://www.contoso.com/MyApplication/Images/SampleImage.jpg" />
on the host but it would be wrong when debugging.

I tried:
'/Images/Aerial-View.jpg'
But that didn't work.Maybe something else is the problem.
If I knew the correct way to reference the Images folder which resides ib
the root folder
(that is the same folder that Default.aspx resides in) I could precede
better.


Thanks
 
Mark Rae said:
Because that's a valid URL.


Because that isn't...


<script type="text/javascript">
var strRoot = '<%=Request.Url.GetLeftPart(UriPartial.Authority) +
ResolveUrl(Request.ApplicationPath)%>';
</script>



Trying to understand. I find that
URL can be an HTML document on the web, it can be an image file...
open (URL, windowName[, windowFeatures])

FROM http://www.ietf.org/rfc/rfc1738.txt:

A file URL takes the form:

file://<host>/<path>

where <host> is the fully qualified domain name of the system on
which the <path> is accessible, and <path> is a hierarchical
directory path of the form <directory>/<directory>/.../<name>.

<host> can be the empty string
1) 'Images/Aerial-View.jpg' looks like a file url with an empty host
but where is the "file://" and the slash in front of <path>?

2)Also, is 'Images/Aerial-View.jpg' the same as
'/Images/Aerial-View.jpg' ?

Finally, I assume the open url does not have to be a file url.
It could be an HTTP url.

3)How does open know what I intended if I do not include either HTML or
FILE?

4)The directory path definition does appear to admit to a device name.
Isn't a device name needed?

Your suggestion appears to produce an http url so I could simply move on but
the confusion indicated by the above lingers.



Thanks a lot
 
Back
Top