Prevent selection being greyed out in iframe in Firefox without using contenteditable

前端 未结 3 1841
天涯浪人
天涯浪人 2021-02-19 10:45

In Firefox 3 and later (and probably older versions), selecting content within an iframe always seems to use the grey selection background colour used for a document that doesn\

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-19 11:17

    Hypothesis: It seems that for dynamically written iFrames, either a XUL Iframe is rendered or the Gecko engine doesn't honor the styles.

    Short of submitting a bug, the only workaround I can see is to wrap our contents in a textarea and style it to make it 'invisible': http://jsfiddle.net/mrchief/YYXSY/19/

提交回复
热议问题