Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <h1>WEBLOC file opener/decoder</h1>

<h3>Upload your .WEBLOC file</h3>

<input type="file" id="myFile" multiple size="50" onchange="myFunction()">

<h3>Result URL</h3>
<p id="demo"><br></p>



<h3>What is a WEBLOC file?</h3>
<p>A description from fileinfo.com:</p>
<blockquote cite="https://fileinfo.com/extension/webloc">
A WEBLOC file is a Mac OS X website shortcut typically generated by the Safari web browser. It contains the URL of a webpage and is created by dragging the website icon next to the address field to the desktop or another folder on the hard drive. WEBLOC files are similar to .URL files created by other programs.
</blockquote>

<!--<p><strong>Tip:</strong> Use the Control or the Shift key to select multiple files.</p>-->
              
            
!

CSS

              
                
              
            
!

JS

              
                $(document).ready(function(){
  myFunction();
});

function myFunction(){
    var x = document.getElementById("myFile");
    var txt = "";
    if ('files' in x) {
        if (x.files.length == 0) {
            txt = "<br>";
        } else {
          //console.log(x.files)
          
            for (var i = 0; i < x.files.length; i++) {
                var file = x.files[i];
                
                ////////////
              
                var reader = new FileReader();
                reader.readAsText(file);
                reader.onloadend = function(){
					var newTxt = "";
                    
                    var xmlData = $(reader.result)[2].innerHTML;
                    
                    parser = new DOMParser();
                    xmlDoc = parser.parseFromString(xmlData,"text/xml");
                    var url = xmlDoc.getElementsByTagName("string")[0].childNodes[0].nodeValue;
                    //console.log(url);
					
					if ('name' in file) {
                		//newTxt += "FileName:<br><strong>" + file.name + "</strong><br>";
                	}
                    newTxt += "<a href='" + url + "'>" + url + "</a>";
					//console.log(newTxt)
					document.getElementById("demo").innerHTML += newTxt;
                };
              
                ////////////
            }
        }
    } 
    else {
        if (x.value == "") {
            txt += "<br>";
        } else {
            txt += "The files property is not supported by your browser!";
            txt  += "<br>The path of the selected file: " + x.value; // If the browser does not support the files property, it will return the path of the selected file instead. 
        }
    }
    document.getElementById("demo").innerHTML = txt;
}
              
            
!
999px

Console