Is it possible to link to a virtual file? This question is best explained by example:
When executing a hyperlink, a browser uses the link extension to determine how to handle the link. For example, if the extension is “.html”, the browser simply opens a new browser window. For links with a “.xls” extension, the browser displays a dialog box prompting the user for the required program to open the link (Microsoft Access in this case). These examples refer to physical files located on the user’s hard drive or Internet server. But what if the file is virtual, existing only in a javascript variable? For instance, if the following code is saved in a local file named “home.kml” and referenced in an anchor tag (<a href=”home.kml”>) the browser will attempt to open Google Maps to process the file.
[CODE]
<?xml version=”1.0″ encoding=”UTF-8″?>
<kml xmlns=”http://earth.google.com/kml/2.0″>
<Placemark>
<name>My House</name>
<LookAt>
<longitude>-112.1604897451107</longitude>
<latitude>33.5435585988906</latitude>
<range>122.7990952690303</range>
<tilt>-1.543474315911411e-010</tilt>
<heading>-0.04806666315645621</heading>
</LookAt>
<visibility>0</visibility>
<styleUrl>root://styles#default+icon=0x307</styleUrl>
<Point>
<coordinates>-112.1604897451107,33.5435585988906,0</coordinates>
</Point>
</Placemark>
</kml>
I can compose a javascript routine that will create the text of the code on the fly and place it in a variable named “MyHouse”. My question is how do I get the browser to execute the code as if were a file with a “.kml” extension?