I want to make a "Copy" button for the header, which copies the URL of the article into the buffer. Tell me how to do this?

    1 answer 1

    document.location 

    contains everything you need.

     document.location.hostname 

    will return the base URL

     document.location.href 

    most likely will return what you need if I understand correctly.

     document.location.pathname 

    will return everything except the base URL.

    For IE, this should work, for writing to the buffer

     clipboardData.setData('text', s);