<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19328"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=875530620-11112012><FONT color=#0000ff 
size=2 face=Arial>you try to get an url for a kmlfile with input type="file" 
(lets you choose a file in your filesystem and not an url), which delivers in 
Firefox only the filename without the path. As far as you load a file from the 
same path as your page, this will work on your local system.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=875530620-11112012><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=875530620-11112012><FONT color=#0000ff 
size=2 face=Arial>In IE and Chrome a fakepath is added to the 
filename.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=875530620-11112012><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px; DISPLAY: inline !important; FONT: 12px Consolas, 'Lucida Console', monospace; WHITE-SPACE: pre-wrap; ORPHANS: 2; FLOAT: none; LETTER-SPACING: normal; COLOR: rgb(255,0,0); WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px"></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=875530620-11112012><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px; DISPLAY: inline !important; FONT: 12px Consolas, 'Lucida Console', monospace; WHITE-SPACE: pre-wrap; ORPHANS: 2; FLOAT: none; LETTER-SPACING: normal; COLOR: rgb(255,0,0); WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">That' 
from Chrome</SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=875530620-11112012><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px; DISPLAY: inline !important; FONT: 12px Consolas, 'Lucida Console', monospace; WHITE-SPACE: pre-wrap; ORPHANS: 2; FLOAT: none; LETTER-SPACING: normal; COLOR: rgb(255,0,0); WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Not 
allowed to load local resource: </SPAN><A 
style="BOX-SIZING: border-box; WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px; FONT: 12px Consolas, 'Lucida Console', monospace; MAX-WIDTH: 100%; WHITE-SPACE: pre-wrap; ORPHANS: 2; LETTER-SPACING: normal; COLOR: rgb(84,84,84); CURSOR: pointer; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" 
class=webkit-html-external-link title=file:///C:/fakepath/Santiago_Calatrava.kml 
href="file:///C:/fakepath/Santiago_Calatrava.kml" 
target=_blank>file:///C:/fakepath/Santiago_Calatrava.kml</A></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=875530620-11112012><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=875530620-11112012><FONT color=#0000ff 
size=2 face=Arial>and with IE it's the same.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=875530620-11112012><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial>Details zum Fehler auf der 
Webseite</FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial>Meldung: Ungültiges 
Argument.<BR>Zeile: 747<BR>Zeichen: 153<BR>Code: 0<BR>URI: </FONT><A 
href="http://localhost/OpenLayers/OpenLayers-2.12/OpenLayers.js"><FONT size=2 
face=Arial>OpenLayers-2.12/OpenLayers.js</FONT></A></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN class=875530620-11112012>Add an 
alert(filename) to your function <FONT color=#000000 size=3>AddLayer() to see 
what will returned.</FONT></SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN class=875530620-11112012><FONT 
color=#000000 size=3></FONT></SPAN></FONT> </DIV>
<DIV><SPAN class=875530620-11112012><FONT color=#0000ff size=2 face=Arial>Good 
luck</FONT></SPAN></DIV>
<DIV><SPAN class=875530620-11112012><FONT color=#0000ff size=2 
face=Arial>Arnd</FONT></SPAN></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><BR></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org 
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von 
</B>robertico<BR><B>Gesendet:</B> Sonntag, 11. November 2012 19:16<BR><B>An:</B> 
openlayers-users@lists.osgeo.org<BR><B>Betreff:</B> Re: [OpenLayers-Users] 
Problem dynamic loading a KML file (refresh)<BR></FONT><BR></DIV>
<DIV></DIV>I changed it this way;<BR><PRE><!DOCTYPE html>
<html>
        <head>
                <title>Loading a KML File</title>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                
                <script type="text/javascript" src="OpenLayers.js"></script>
                
        <style>
        <!--
                html, body 
                {
                        width: 100%;
                        height: 100%;
                        margin: 0;
                        padding: 0;
                }
        -->
        </style>

        <script type="text/javascript">
        
        var filename = "";
        var map;
        var kml_layer;
                        
        function init() 
        {               
                var options =   {
                        minResolution: "auto",
                        minExtent: new OpenLayers.Bounds(-1, -1, 1, 1),
                        maxResolution: "auto",
                        maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90),
                        controls: [
                        new OpenLayers.Control.LayerSwitcher({'ascending':false}),
                        new OpenLayers.Control.Navigation(),
                        new OpenLayers.Control.PanZoom(),
                        new OpenLayers.Control.KeyboardDefaults()
                        ],
                        numZoomLevels: 19,
                        units: 'm',
                        projection: new OpenLayers.Projection("EPSG:900913"),
                        displayProjection: new OpenLayers.Projection("EPSG:4326")
                };

                map = new OpenLayers.Map("map", options);

                var osm_layer = new OpenLayers.Layer.OSM();
                map.addLayer(osm_layer);

                kml_layer = new OpenLayers.Layer.Vector("KML", {
                        projection: map.displayProjection,
                        strategies: [new OpenLayers.Strategy.Fixed()],                  
                        protocol: new OpenLayers.Protocol.HTTP({
                                url: filename,
                                format: new OpenLayers.Format.KML({
                                        extractStyles: true,
                                        extractAttributes: true,
                                        maxDepth: 10
                                })
                        })
                });
                        
                map.addLayer(kml_layer);
                                
                map.zoomToMaxExtent();  
        }
        
        function AddLayer()
        {
                // get KML file
                filename = document.getElementById('theFile').value;

                if(filename == "")
                {
                        alert("Select KML file");
                }
                else
                {
                        kml_layer.refresh({url: filename });
                }                       
        }
                        
        </script>
        
        </head>
        
        <body onload="init()">
        
            <div id="top" style="width: 100%; height: 15pt; padding: 5px;">
                        <input type="file" id="theFile" size="100" />
                        &nbsp;&nbsp;
                        <input type="button" value="Show Markers" onClick="AddLayer()">
                </div>
                
                <div id="map" style="width: 100%; height: 100%;"></div>

        </body>
</html></PRE><BR><BR>Works excellent in Mozilla Firefox but again not in 
IE and Chrome.<BR><BR>Error message in IE:<BR><PRE>Webpage error details
Message: Invalid argument.
Line: 747
Char: 153
Code: 0
URI: file:///D:/openlayers/OpenLayers.js
</PRE><BR><BR>This part from OpenLayers.js <BR><PRE>(a[1]||a[7])){b=parseInt(a[1],10)||0;var c=parseInt(a[2],10)-1||0,d=parseInt(a[3],10)||1;b=new Date(Date.UTC(b,c,d));if(c=a[7]){var d=parseInt(a[4],10),e=parseInt(a[5],10),f=parseFloat(a[6]),g=f|0,f=Math.round(1E3*(f-g));b.setUTCHours(d,e,g,f);"Z"!==c&&(c=parseInt(c,10),a=parseInt(a[8],10)||0,b=new Date(b.getTime()+-1E3*(60*60*c+</PRE><BR><BR>char: 
153 starts at;<BR><PRE>e=parseInt(a[5...</PRE><BR><BR>What's going wrong ???? <BR>
<HR align=left width=300>
View this message in context: <A 
href="http://osgeo-org.1560.n6.nabble.com/Problem-dynamic-loading-a-KML-file-refresh-tp5015133p5015436.html">Re: 
Problem dynamic loading a KML file (refresh)</A><BR>Sent from the <A 
href="http://osgeo-org.1560.n6.nabble.com/OpenLayers-Users-f3910695.html">OpenLayers 
Users mailing list archive</A> at Nabble.com.<BR></BODY></HTML>