Highlighted

Adding Text to the Copy Event not working in IE

Community Beginner ,
Sep 19, 2016

Copy link to clipboard

Copied

Hi,

I added an addTextToCopy() function to my topics in RoboHelp 2015 and the FlashHelp output works in every browser except for Internet Explorer. I tested the function on a test site and it works fine ... it is only in the FlashHelp output that the function does not work in IE. Would appreciate any ideas!

Thanks,

AV

PS : Just in case, this is the script :

<script language="javascript">

function addTextToCopy() {

         var selection = window.getSelection(),

             

            pagelink = '<br><br> My copyright text',

             copytext = selection + pagelink,

             newdiv = document.createElement('div');

         newdiv.style.position = 'absolute';

         newdiv.style.left = '-99999px';

         document.body.appendChild(newdiv);

         newdiv.innerHTML = copytext;

         selection.selectAllChildren(newdiv);

         window.setTimeout(function () {

             document.body.removeChild(newdiv);

         }, 100);

     }

     document.addEventListener('copy', addTextToCopy);

< /script>

Topics

FlashHelp

Views

412

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Adding Text to the Copy Event not working in IE

Community Beginner ,
Sep 19, 2016

Copy link to clipboard

Copied

Hi,

I added an addTextToCopy() function to my topics in RoboHelp 2015 and the FlashHelp output works in every browser except for Internet Explorer. I tested the function on a test site and it works fine ... it is only in the FlashHelp output that the function does not work in IE. Would appreciate any ideas!

Thanks,

AV

PS : Just in case, this is the script :

<script language="javascript">

function addTextToCopy() {

         var selection = window.getSelection(),

             

            pagelink = '<br><br> My copyright text',

             copytext = selection + pagelink,

             newdiv = document.createElement('div');

         newdiv.style.position = 'absolute';

         newdiv.style.left = '-99999px';

         document.body.appendChild(newdiv);

         newdiv.innerHTML = copytext;

         selection.selectAllChildren(newdiv);

         window.setTimeout(function () {

             document.body.removeChild(newdiv);

         }, 100);

     }

     document.addEventListener('copy', addTextToCopy);

< /script>

Topics

FlashHelp

Views

413

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 19, 2016 0

Have something to add?

Join the conversation