How do I create a .url file on OS X?












17















I am creating a zip file and would like to include a link to a website within it so that users can double-click on the file and go straight to the website. In my research, I discovered that what I want is a .url file because it is cross-platform.



However, I can't seem to create one on a Mac. Whenever I drag a URL to my desktop, a .webloc file is created instead. This file is typically associated with Safari and isn't readable on Windows, so it won't work. Unfortunately, it's created even if I drag the URL from an alternative web browser, like Firefox.



According to this page, there is some non-trivial data within a .url file that makes it so that I can't just create one myself in a text editor without knowing what I'm doing. So how can I create a .url file on a Mac?










share|improve this question



























    17















    I am creating a zip file and would like to include a link to a website within it so that users can double-click on the file and go straight to the website. In my research, I discovered that what I want is a .url file because it is cross-platform.



    However, I can't seem to create one on a Mac. Whenever I drag a URL to my desktop, a .webloc file is created instead. This file is typically associated with Safari and isn't readable on Windows, so it won't work. Unfortunately, it's created even if I drag the URL from an alternative web browser, like Firefox.



    According to this page, there is some non-trivial data within a .url file that makes it so that I can't just create one myself in a text editor without knowing what I'm doing. So how can I create a .url file on a Mac?










    share|improve this question

























      17












      17








      17


      6






      I am creating a zip file and would like to include a link to a website within it so that users can double-click on the file and go straight to the website. In my research, I discovered that what I want is a .url file because it is cross-platform.



      However, I can't seem to create one on a Mac. Whenever I drag a URL to my desktop, a .webloc file is created instead. This file is typically associated with Safari and isn't readable on Windows, so it won't work. Unfortunately, it's created even if I drag the URL from an alternative web browser, like Firefox.



      According to this page, there is some non-trivial data within a .url file that makes it so that I can't just create one myself in a text editor without knowing what I'm doing. So how can I create a .url file on a Mac?










      share|improve this question














      I am creating a zip file and would like to include a link to a website within it so that users can double-click on the file and go straight to the website. In my research, I discovered that what I want is a .url file because it is cross-platform.



      However, I can't seem to create one on a Mac. Whenever I drag a URL to my desktop, a .webloc file is created instead. This file is typically associated with Safari and isn't readable on Windows, so it won't work. Unfortunately, it's created even if I drag the URL from an alternative web browser, like Firefox.



      According to this page, there is some non-trivial data within a .url file that makes it so that I can't just create one myself in a text editor without knowing what I'm doing. So how can I create a .url file on a Mac?







      macos url






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 17 '13 at 6:38









      ThunderforgeThunderforge

      4621616




      4621616






















          2 Answers
          2






          active

          oldest

          votes


















          26














          Add these lines in TextEdit and save as .Url



          [InternetShortcut]
          URL=http://www.yourfavweb.com/
          IconIndex=0





          share|improve this answer





















          • 4





            I don't think the IconIndex is necessary.

            – hectorpal
            Jun 23 '16 at 13:06











          • It's up to you to give Icon for the shortcut. So why not?

            – Kirk
            Jul 31 '17 at 5:29






          • 3





            "It's up to you implies" it's not necessary.

            – hectorpal
            Aug 6 '17 at 23:27



















          6














          Following Kirk's answer, here is an small bash script for creating such files. Executing



          url-create.sh superuser-site http://superuser.com/


          creates a file superuser-site.url:



          [InternetShortcut]
          URL=http://superuser.com/


          The url-create.sh shell script is the following:



          #!/bin/bash
          if [[ $# -le 1 || $# -ge 3 ]] ; then
          echo Usage: $0 '<namefile> <url>'
          echo
          echo Creates '<namefile>.url'.
          echo Openning '<namefile>.url' in Finder, under OSX, will open '<url>' in the default browser.
          exit 1
          fi

          file="$1.url"
          url=$2
          echo '[InternetShortcut]' > "$file"
          echo -n 'URL=' >> "$file"
          echo $url >> "$file"
          #echo 'IconIndex=0' >> "$file"


          PS: I don't think the IconIndex is necessary, so I commented it out.






          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f689441%2fhow-do-i-create-a-url-file-on-os-x%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            26














            Add these lines in TextEdit and save as .Url



            [InternetShortcut]
            URL=http://www.yourfavweb.com/
            IconIndex=0





            share|improve this answer





















            • 4





              I don't think the IconIndex is necessary.

              – hectorpal
              Jun 23 '16 at 13:06











            • It's up to you to give Icon for the shortcut. So why not?

              – Kirk
              Jul 31 '17 at 5:29






            • 3





              "It's up to you implies" it's not necessary.

              – hectorpal
              Aug 6 '17 at 23:27
















            26














            Add these lines in TextEdit and save as .Url



            [InternetShortcut]
            URL=http://www.yourfavweb.com/
            IconIndex=0





            share|improve this answer





















            • 4





              I don't think the IconIndex is necessary.

              – hectorpal
              Jun 23 '16 at 13:06











            • It's up to you to give Icon for the shortcut. So why not?

              – Kirk
              Jul 31 '17 at 5:29






            • 3





              "It's up to you implies" it's not necessary.

              – hectorpal
              Aug 6 '17 at 23:27














            26












            26








            26







            Add these lines in TextEdit and save as .Url



            [InternetShortcut]
            URL=http://www.yourfavweb.com/
            IconIndex=0





            share|improve this answer















            Add these lines in TextEdit and save as .Url



            [InternetShortcut]
            URL=http://www.yourfavweb.com/
            IconIndex=0






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 9 '14 at 5:25









            Thunderforge

            4621616




            4621616










            answered Dec 17 '13 at 6:47









            KirkKirk

            933713




            933713








            • 4





              I don't think the IconIndex is necessary.

              – hectorpal
              Jun 23 '16 at 13:06











            • It's up to you to give Icon for the shortcut. So why not?

              – Kirk
              Jul 31 '17 at 5:29






            • 3





              "It's up to you implies" it's not necessary.

              – hectorpal
              Aug 6 '17 at 23:27














            • 4





              I don't think the IconIndex is necessary.

              – hectorpal
              Jun 23 '16 at 13:06











            • It's up to you to give Icon for the shortcut. So why not?

              – Kirk
              Jul 31 '17 at 5:29






            • 3





              "It's up to you implies" it's not necessary.

              – hectorpal
              Aug 6 '17 at 23:27








            4




            4





            I don't think the IconIndex is necessary.

            – hectorpal
            Jun 23 '16 at 13:06





            I don't think the IconIndex is necessary.

            – hectorpal
            Jun 23 '16 at 13:06













            It's up to you to give Icon for the shortcut. So why not?

            – Kirk
            Jul 31 '17 at 5:29





            It's up to you to give Icon for the shortcut. So why not?

            – Kirk
            Jul 31 '17 at 5:29




            3




            3





            "It's up to you implies" it's not necessary.

            – hectorpal
            Aug 6 '17 at 23:27





            "It's up to you implies" it's not necessary.

            – hectorpal
            Aug 6 '17 at 23:27













            6














            Following Kirk's answer, here is an small bash script for creating such files. Executing



            url-create.sh superuser-site http://superuser.com/


            creates a file superuser-site.url:



            [InternetShortcut]
            URL=http://superuser.com/


            The url-create.sh shell script is the following:



            #!/bin/bash
            if [[ $# -le 1 || $# -ge 3 ]] ; then
            echo Usage: $0 '<namefile> <url>'
            echo
            echo Creates '<namefile>.url'.
            echo Openning '<namefile>.url' in Finder, under OSX, will open '<url>' in the default browser.
            exit 1
            fi

            file="$1.url"
            url=$2
            echo '[InternetShortcut]' > "$file"
            echo -n 'URL=' >> "$file"
            echo $url >> "$file"
            #echo 'IconIndex=0' >> "$file"


            PS: I don't think the IconIndex is necessary, so I commented it out.






            share|improve this answer






























              6














              Following Kirk's answer, here is an small bash script for creating such files. Executing



              url-create.sh superuser-site http://superuser.com/


              creates a file superuser-site.url:



              [InternetShortcut]
              URL=http://superuser.com/


              The url-create.sh shell script is the following:



              #!/bin/bash
              if [[ $# -le 1 || $# -ge 3 ]] ; then
              echo Usage: $0 '<namefile> <url>'
              echo
              echo Creates '<namefile>.url'.
              echo Openning '<namefile>.url' in Finder, under OSX, will open '<url>' in the default browser.
              exit 1
              fi

              file="$1.url"
              url=$2
              echo '[InternetShortcut]' > "$file"
              echo -n 'URL=' >> "$file"
              echo $url >> "$file"
              #echo 'IconIndex=0' >> "$file"


              PS: I don't think the IconIndex is necessary, so I commented it out.






              share|improve this answer




























                6












                6








                6







                Following Kirk's answer, here is an small bash script for creating such files. Executing



                url-create.sh superuser-site http://superuser.com/


                creates a file superuser-site.url:



                [InternetShortcut]
                URL=http://superuser.com/


                The url-create.sh shell script is the following:



                #!/bin/bash
                if [[ $# -le 1 || $# -ge 3 ]] ; then
                echo Usage: $0 '<namefile> <url>'
                echo
                echo Creates '<namefile>.url'.
                echo Openning '<namefile>.url' in Finder, under OSX, will open '<url>' in the default browser.
                exit 1
                fi

                file="$1.url"
                url=$2
                echo '[InternetShortcut]' > "$file"
                echo -n 'URL=' >> "$file"
                echo $url >> "$file"
                #echo 'IconIndex=0' >> "$file"


                PS: I don't think the IconIndex is necessary, so I commented it out.






                share|improve this answer















                Following Kirk's answer, here is an small bash script for creating such files. Executing



                url-create.sh superuser-site http://superuser.com/


                creates a file superuser-site.url:



                [InternetShortcut]
                URL=http://superuser.com/


                The url-create.sh shell script is the following:



                #!/bin/bash
                if [[ $# -le 1 || $# -ge 3 ]] ; then
                echo Usage: $0 '<namefile> <url>'
                echo
                echo Creates '<namefile>.url'.
                echo Openning '<namefile>.url' in Finder, under OSX, will open '<url>' in the default browser.
                exit 1
                fi

                file="$1.url"
                url=$2
                echo '[InternetShortcut]' > "$file"
                echo -n 'URL=' >> "$file"
                echo $url >> "$file"
                #echo 'IconIndex=0' >> "$file"


                PS: I don't think the IconIndex is necessary, so I commented it out.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 21 at 22:15

























                answered Jun 23 '16 at 12:51









                hectorpalhectorpal

                1,48811011




                1,48811011






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f689441%2fhow-do-i-create-a-url-file-on-os-x%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                    Alcedinidae

                    RAC Tourist Trophy