最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Javascript Prompt() text is partially hidden in Internet Explorer 11 - Stack Overflow

programmeradmin4浏览0评论

I am trying to display a "larger than normal" amount of text in a prompt() box. When calling the javascript prompt() function in Internet Explorer 11, a large portion of my text is being hidden. It seems to only support 2 lines of text. Chrome, Firefox and Opera seem to work fine. This seems to be just an IE issue.

Here is a fiddle that demonstrates the problem: JSFiddle Example

prompt("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum     has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.");

I am only able to see this text "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when". The rest is not displayed.

I'm afraid I already know the answer, but is there a reason why this is happening? I would prefer to use the prompt() and not use a custom modal.

I am trying to display a "larger than normal" amount of text in a prompt() box. When calling the javascript prompt() function in Internet Explorer 11, a large portion of my text is being hidden. It seems to only support 2 lines of text. Chrome, Firefox and Opera seem to work fine. This seems to be just an IE issue.

Here is a fiddle that demonstrates the problem: JSFiddle Example

prompt("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum     has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.");

I am only able to see this text "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when". The rest is not displayed.

I'm afraid I already know the answer, but is there a reason why this is happening? I would prefer to use the prompt() and not use a custom modal.

Share Improve this question edited Jan 10, 2015 at 19:17 Sampson 269k76 gold badges545 silver badges568 bronze badges asked Nov 4, 2014 at 22:09 Clayton HyattClayton Hyatt 2885 silver badges13 bronze badges 10
  • 2 The easiest solution is to not use a prompt box. – Sterling Archer Commented Nov 4, 2014 at 22:13
  • 4 this browser effs up even a cup of coffee..this is unreal..in an ideal world I'd protest against supporting the browser itself, not the prompt thing.. – nicholaswmin Commented Nov 4, 2014 at 22:28
  • 2 You should use an alternative like the JQuery dialog. – Donal Commented Nov 4, 2014 at 22:31
  • 1 @NicholasKyriakides If you know of any serious issue we're failing at, please feel free to ping me personally and I'll work towards getting it fixed. – Sampson Commented Nov 4, 2014 at 22:31
  • 1 @JLRishe The amount of small issues like this is what the problem is with IE. The prompt is also the only way to ask a question and also block the thread. It contains 2 buttons and text. Limiting the text to 2 lines for no apparent reason is what puts me off. – nicholaswmin Commented Jan 10, 2015 at 19:43
 |  Show 5 more ments

3 Answers 3

Reset to default 5

You should probably not use window.prompt to begin with. It is largely frowned upon due to the fact it blocks the thread, and thus can halt your application. The web today has moved towards leveraging the asynchronous nature of JavaScript; this should distance us from things like alert, prompt, etc.

Presently the prompt is not supported in Immersive Internet Explorer ("Metro"), Internet Explorer on the xbox, or Windows Web Applications (formerly Windows Store Applications). Instead, you are encouraged to leverage third-party tools and libraries (such as Bootstrap, jQuery UI, etc) for these types of needs.

All of this being said, it is a genuine difference between Internet Explorer and other modern browsers, and as a result I have opened up an issue internally for the IE team to discuss.

The IE version of prompt does not dynamically resize.

You should only be using prompts for small messages, not whole paragraphs. like

e-mail:

or

username:

You should have any explanation stuff inline on the web page. or better yet don't use prompt's at all and use inline forms.

You can use one of these alerts, even simpler than modals:

If you use Bootstrap, Bootboxjs is for you: http://bootboxjs./

Sweetalert is also simple and cool: http://tristanedwards.me/sweetalert

发布评论

评论列表(0)

  1. 暂无评论