0

So I'm trying to get a url I have stored in the clipboard to render in my iframe via url.

Not sure what to make of this code.

<iframe id="showskill" scrolling="yes" height="100%" width ="100%" src=""+ ReturnURL()></iframe>
<script>
function ReturnURL() {    
    var el = document.createElement('textarea');
    document.body.appendChild(el);
    el.focus();
    document.execCommand('paste');
    var value = el.value;
    document.body.removeChild(el)
    return value;
}
console.log(getClipboard());
</script>

Suggestions welcome.

  • Ry3yr

Edit: This looks like a step in the right direction ? How to use javascript variable in iframe src Edit2: New code, same fate...

3
  • I think you are not using the promise right Commented Nov 4, 2021 at 16:10
  • Are you using come sort of templating language? Your JS and HTML are rather mashed together in a way that is definitely not valid on its own (HTML inside a script tag) Commented Nov 4, 2021 at 16:37
  • I'm calling an html-iframe from javascript, because I hoped I could (that way) pass the clipboard content to the iframes "src" field. I got the code from stackoverflow.com/a/8726661/3708093 Commented Nov 4, 2021 at 16:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.