# Why this sample does not work in Chrome?

**URL:** <https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544>\
**Category:** Questions\
**Tags:** web\_viewer, clipboard, copy\
**Created:** [November 27, 2019, 1:59pm UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544 "2019-11-27T13:59:50Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![samfmp](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@samfmp](https://the.fmsoup.org/u/samfmp)\
**Post date:** [November 27, 2019, 1:59pm UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/1 "2019-11-27T13:59:50Z")

</div>

[WDCopyToClipboard.fmp12](https://the.fmsoup.org/uploads/short-url/fyPB3FiiPcC1VQEm6u4Iq1DUcnZ.fmp12) (208 KB)

Hi, I am not sure is that ok to share the sample file here. If not, I will delete it. I have taken it from the official community.  
This sample file is used to copy text from fields to the clipboard in web direct. But I have tested it in safari and chrome, it only works in safari.

Does anyone know the reason why it does not work in chrome?

---

<div class="post-metadata">

**Author:** ![Otmar](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/otmar/32/703_2.png) [@Otmar](https://the.fmsoup.org/u/Otmar)\
**Post date:** [November 27, 2019, 10:58pm UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/2 "2019-11-27T22:58:15Z")

</div>

You’re generated code contains a ‘#’-character, this breaks the iframe in WebD. You can either URLEncode the code or just replace the ‘#’ with ‘%23’, have a look at the attached sample.

best  
Otmar[WDCopyToClipboardChromeFirefox.fmp12.zip](https://the.fmsoup.org/uploads/short-url/2tnkrtws51Spy2mAlvb9OfGgJ8l.zip) (73.2 KB)

---

<div class="post-metadata">

**Author:** ![samfmp](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@samfmp](https://the.fmsoup.org/u/samfmp)\
**Post date:** [November 28, 2019, 12:39am UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/3 "2019-11-28T00:39:49Z")

</div>

Thank you. It seems that it does not work in Edge and IE?

---

<div class="post-metadata">

**Author:** ![Otmar](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/otmar/32/703_2.png) [@Otmar](https://the.fmsoup.org/u/Otmar)\
**Post date:** [November 28, 2019, 7:24am UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/4 "2019-11-28T07:24:21Z")

</div>

Yes, no data/text iframes in Edge and IE, you’d have to export the html-code to FMS webroot and link it from there.

---

<div class="post-metadata">

**Author:** ![samfmp](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@samfmp](https://the.fmsoup.org/u/samfmp)\
**Post date:** [November 28, 2019, 7:28am UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/5 "2019-11-28T07:28:52Z")

</div>

Thank you. I am new to web-direct, which folder should I export to? 😅

---

<div class="post-metadata">

**Author:** ![Otmar](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/otmar/32/703_2.png) [@Otmar](https://the.fmsoup.org/u/Otmar)\
**Post date:** [November 28, 2019, 8:18am UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/6 "2019-11-28T08:18:56Z")

</div>

If you’re on windows, put it here:  
C:\Program Files\FileMaker\FileMaker Server\HTTPServer\conf\yourbutton.html  
on macOS:  
/Library/FileMaker Server/HTTPServer/htdocs/httpsRoot/yourbutton.html

and the webviewer point to: [https://your.webd.url/yourbutton.html](https://your.webd.url/yourbutton.html) (without /fmi/webd…)

---

<div class="post-metadata">

**Author:** ![samfmp](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@samfmp](https://the.fmsoup.org/u/samfmp)\
**Post date:** [November 28, 2019, 1:16pm UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/7 "2019-11-28T13:16:17Z")

</div>

Thank you. I will try later.

---

<div class="post-metadata">

**Author:** ![samfmp](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@samfmp](https://the.fmsoup.org/u/samfmp)\
**Post date:** [December 2, 2019, 2:41am UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/8 "2019-12-02T02:41:41Z")

</div>

Hi, I have exported it to html file and I could see it on layout, but how do I run javascript and return the field value back to the clipboard?

---

<div class="post-metadata">

**Author:** ![Otmar](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/otmar/32/703_2.png) [@Otmar](https://the.fmsoup.org/u/Otmar)\
**Post date:** [December 3, 2019, 11:05am UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/9 "2019-12-03T11:05:00Z")

</div>

You’d have to recreate the html file on every field change or record switch. With the new file script steps of FM(S)18 or BE plugin you can do this with PSOS. To be able to write to the web root folder of FMS, it has to be sym-linked into the DATA/Documents folder.  
Attached file has a script that generates the needed command to be executed on the server machine.

best  
Otmar[WDCopyToClipboardAllBrowser.fmp12.zip](https://the.fmsoup.org/uploads/short-url/xm844GW0TqiTcKIG1D2QMoYnHUD.zip) (78.0 KB)

---

<div class="post-metadata">

**Author:** ![steve\_ssh](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/steve_ssh/32/160_2.png) [@steve\_ssh](https://the.fmsoup.org/u/steve_ssh)\
**Post date:** [December 3, 2019, 4:36pm UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/10 "2019-12-03T16:36:47Z")

</div>

Hello @Otmar

It is really great to have your presence here in this forum!

**Regarding this particular topic:**

Another way that I have handled the case of passing data into a file served from WebD web server root into a WebD webviewer (iframe) is to pass the payload in the URL as either a query-string value or a hash value (I no longer recall which I used). This always worked reliably for me, but I never tested it with browsers on Windows machines. It allowed for the html file in the webserver directory to be static – no need to recreate it at each call. (The file simply must be re-designed to pull its target value from the URL). The only downside that I know of is that it only works reliably with _small_ payloads.

I know that you have super amazing expertise in this area. Aside from length limitations, have you run into any other issues with such an approach?

If you have any thoughts to share about this, I’d love to hear them.

Again - great to see you here.

Kind regards,

-steve

---

<div class="post-metadata">

**Author:** ![Otmar](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/otmar/32/703_2.png) [@Otmar](https://the.fmsoup.org/u/Otmar)\
**Post date:** [December 3, 2019, 5:27pm UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/11 "2019-12-03T17:27:56Z")

</div>

Hi @steve_ssh

Same great to have you around here!  
I’ve just recently came up with this way to write to the web-root by trying to get my ResourceCalendar work in WebDirect and Edge/IE, as those don’t support data/text in iframes. To have all the needed variables filled by payload would have been a much bigger task.  
The copy button is just an adoption of this, and yes definitely a candidate for the payload approach, as long the to copy field content does not exceed max param length.

best  
Otmar

---

<div class="post-metadata">

**Author:** ![steve\_ssh](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/steve_ssh/32/160_2.png) [@steve\_ssh](https://the.fmsoup.org/u/steve_ssh)\
**Post date:** [December 3, 2019, 5:54pm UTC](https://the.fmsoup.org/t/why-this-sample-does-not-work-in-chrome/544/12 "2019-12-03T17:54:03Z")

</div>

Awesome. Thank you, @Otmar
