How to write in 'mailto' body link to current page

前端 未结 4 1828
孤城傲影
孤城傲影 2020-12-16 01:56

I have mailto button in all pages of my site and I want to write reference to that page in e-mail body.

In one page I can have



        
4条回答
  •  清歌不尽
    2020-12-16 02:33

    You can put a JS on every page that can modify all the hrefs of all email link when the document loads.

    I'll use jQuery for the example code because is more compact, but this can be achieved also with pure JS:

    $(document).ready(function(){
        $(".email").attr("href", "mailto:?subject=Interesting%20information&body=I thought you might find this information interesting:%20%0d%0a"+window.location);
    });
    

提交回复
热议问题