Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12231

JS navigator.clipboard.writeText() run on localserver accessed via another PC over LAN [duplicate]

$
0
0

I have this strange js issue: I am running the js code below...

jQuery('.hardlink').click(function(){    var hardlink = jQuery(this).attr("data-hardlink");    navigator.clipboard.writeText(hardlink).then(function () {        alert('OK');    }, function () {        alert('Failed!');    });});

When I access it on:

  • live server (internet) via PC: works
  • live server (internet) viaAndroid (smartphone): works
  • localserver via the PC where the localserver isinstalled on: works
  • localserver via PC over the same LAN (testververis on 192.168.1.4:8081): FAIL!
  • localserver via Android(smartphone) over the same LAN (testverver is on 192.168.1.4:8081):FAIL!

I just migrated form the old PHP 5.4 to the more recent PHP 8.1. When I was still on the old PHP, it was accessed without any problem in all the cases shown above, thus I am suspecting there is something in the php.ini (PHP settings of the localserver) that is now different, but I have no clue what that might be.

I opened Console on the Chrome browser where I run the webpage on that PC over LAN and the error reads:

Uncaught TypeError: Cannot read properties of undefined (reading 'writeText') at HTMLSpanElement.<anonymous>

Does anyone knows what possible specific settings needs to be changed/updated in the PHP (or even Apache maybe?), so that the js code would work once again in all the shown cases above (just guessing)? Or is it in something completely different?

This DOES NOT ANSWER MY QUESTION AT ALL, please, read what I wrote in my post before you set it as "closed" and as "being answered elsewhere": it works in all instances except when accessed testserver via PC on LAN = COMPLETELLY DIFFERENT ISSUE< how could you set it as closed and the same as the question in link?!


Viewing all articles
Browse latest Browse all 12231

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>