문제

Junk characters are copied to the clipboard on iOS when doing a long-hold/copy on the following html element:

<input type="text" value="inputValue" ng-readonly="true" name="externalInput" readonly="readonly" />

Output:

{\rtf1\ansi\ansicpg1252
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;\red85\green85\blue102;\red255\green255\blue255;}
\deftab720
\pard\pardeftab720\sl400\partightenfactor0

\f0\fs28 \cf2 \cb3 \expnd0\expndtw0\kerning0
\outl0\strokewidth0 \strokec2 inputValue}

How can I stop all of that style info being copied? This only seems to happen on mobile safari.

도움이 되었습니까?

해결책

Turns out that iOS doesn't like you selecting the text of a readonly="readonly" input. To work around this I change the input to normal (editable) if the user agent is appleios.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top