Add a Spotify link in an HTML form












0















It's pretty easy to copy a Spotify song URL and generate the required iframe code to paste into your own HTML code, e.g:



<iframe src="https://open.spotify.com/embed/track/1q8gelFgFYUwoWpQV7WNCe" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>


just for others' reference, details of how to do this can be found at https://developer.spotify.com/documentation/widgets/generate/play-button/



However, the question I have is about allowing a user to paste this same code into an HTML form, to allow it to show on a user's profile page. The only ways I can think of doing this currently are either:




  1. Use an tag and ask the user to first remove the and " from the link before pasting (e.g. https://open.spotify.com/embed/track/1q8gelFgFYUwoWpQV7WNCe" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media). Then, using the pasted text as a variable between tags. This method is not preferred as requires action from the user.


  2. Allow the user to paste the entire link, then use a function to remove the /", before following the same approach of using the code as a variable.



Is there a more straightforward approach I am missing here? Is there a way the entire <iframe> code can be pasted into a form to directly appear on the user's profile?



Thanks in advance for any assistance.










share|improve this question





























    0















    It's pretty easy to copy a Spotify song URL and generate the required iframe code to paste into your own HTML code, e.g:



    <iframe src="https://open.spotify.com/embed/track/1q8gelFgFYUwoWpQV7WNCe" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>


    just for others' reference, details of how to do this can be found at https://developer.spotify.com/documentation/widgets/generate/play-button/



    However, the question I have is about allowing a user to paste this same code into an HTML form, to allow it to show on a user's profile page. The only ways I can think of doing this currently are either:




    1. Use an tag and ask the user to first remove the and " from the link before pasting (e.g. https://open.spotify.com/embed/track/1q8gelFgFYUwoWpQV7WNCe" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media). Then, using the pasted text as a variable between tags. This method is not preferred as requires action from the user.


    2. Allow the user to paste the entire link, then use a function to remove the /", before following the same approach of using the code as a variable.



    Is there a more straightforward approach I am missing here? Is there a way the entire <iframe> code can be pasted into a form to directly appear on the user's profile?



    Thanks in advance for any assistance.










    share|improve this question



























      0












      0








      0








      It's pretty easy to copy a Spotify song URL and generate the required iframe code to paste into your own HTML code, e.g:



      <iframe src="https://open.spotify.com/embed/track/1q8gelFgFYUwoWpQV7WNCe" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>


      just for others' reference, details of how to do this can be found at https://developer.spotify.com/documentation/widgets/generate/play-button/



      However, the question I have is about allowing a user to paste this same code into an HTML form, to allow it to show on a user's profile page. The only ways I can think of doing this currently are either:




      1. Use an tag and ask the user to first remove the and " from the link before pasting (e.g. https://open.spotify.com/embed/track/1q8gelFgFYUwoWpQV7WNCe" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media). Then, using the pasted text as a variable between tags. This method is not preferred as requires action from the user.


      2. Allow the user to paste the entire link, then use a function to remove the /", before following the same approach of using the code as a variable.



      Is there a more straightforward approach I am missing here? Is there a way the entire <iframe> code can be pasted into a form to directly appear on the user's profile?



      Thanks in advance for any assistance.










      share|improve this question
















      It's pretty easy to copy a Spotify song URL and generate the required iframe code to paste into your own HTML code, e.g:



      <iframe src="https://open.spotify.com/embed/track/1q8gelFgFYUwoWpQV7WNCe" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>


      just for others' reference, details of how to do this can be found at https://developer.spotify.com/documentation/widgets/generate/play-button/



      However, the question I have is about allowing a user to paste this same code into an HTML form, to allow it to show on a user's profile page. The only ways I can think of doing this currently are either:




      1. Use an tag and ask the user to first remove the and " from the link before pasting (e.g. https://open.spotify.com/embed/track/1q8gelFgFYUwoWpQV7WNCe" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media). Then, using the pasted text as a variable between tags. This method is not preferred as requires action from the user.


      2. Allow the user to paste the entire link, then use a function to remove the /", before following the same approach of using the code as a variable.



      Is there a more straightforward approach I am missing here? Is there a way the entire <iframe> code can be pasted into a form to directly appear on the user's profile?



      Thanks in advance for any assistance.







      javascript html forms iframe






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 14:03







      Martin

















      asked Jan 1 at 10:05









      MartinMartin

      103




      103
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Better approach considering user experience would be ask user to paste spotify uri (using button "Copy Spotify URI")
          After that you can format that URI using script to get this part
          spotify:track:1NpSdOfFA7XPpEKlTV4OTr



          Then just put that formatted part here:
          enter image description here






          share|improve this answer
























          • Thanks for your input! That is a good suggestion as it seems that is the only element of the link that actually changes each time.

            – Martin
            Jan 2 at 23:39











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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%2fstackoverflow.com%2fquestions%2f53994578%2fadd-a-spotify-link-in-an-html-form%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Better approach considering user experience would be ask user to paste spotify uri (using button "Copy Spotify URI")
          After that you can format that URI using script to get this part
          spotify:track:1NpSdOfFA7XPpEKlTV4OTr



          Then just put that formatted part here:
          enter image description here






          share|improve this answer
























          • Thanks for your input! That is a good suggestion as it seems that is the only element of the link that actually changes each time.

            – Martin
            Jan 2 at 23:39
















          0














          Better approach considering user experience would be ask user to paste spotify uri (using button "Copy Spotify URI")
          After that you can format that URI using script to get this part
          spotify:track:1NpSdOfFA7XPpEKlTV4OTr



          Then just put that formatted part here:
          enter image description here






          share|improve this answer
























          • Thanks for your input! That is a good suggestion as it seems that is the only element of the link that actually changes each time.

            – Martin
            Jan 2 at 23:39














          0












          0








          0







          Better approach considering user experience would be ask user to paste spotify uri (using button "Copy Spotify URI")
          After that you can format that URI using script to get this part
          spotify:track:1NpSdOfFA7XPpEKlTV4OTr



          Then just put that formatted part here:
          enter image description here






          share|improve this answer













          Better approach considering user experience would be ask user to paste spotify uri (using button "Copy Spotify URI")
          After that you can format that URI using script to get this part
          spotify:track:1NpSdOfFA7XPpEKlTV4OTr



          Then just put that formatted part here:
          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 1 at 14:20









          Hlib LiapotaHlib Liapota

          586




          586













          • Thanks for your input! That is a good suggestion as it seems that is the only element of the link that actually changes each time.

            – Martin
            Jan 2 at 23:39



















          • Thanks for your input! That is a good suggestion as it seems that is the only element of the link that actually changes each time.

            – Martin
            Jan 2 at 23:39

















          Thanks for your input! That is a good suggestion as it seems that is the only element of the link that actually changes each time.

          – Martin
          Jan 2 at 23:39





          Thanks for your input! That is a good suggestion as it seems that is the only element of the link that actually changes each time.

          – Martin
          Jan 2 at 23:39




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • 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%2fstackoverflow.com%2fquestions%2f53994578%2fadd-a-spotify-link-in-an-html-form%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

          Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

          ts Property 'filter' does not exist on type '{}'

          mat-slide-toggle shouldn't change it's state when I click cancel in confirmation window