搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

window.alert window size

  • 7 回覆
  • 1 有這個問題
  • 6 次檢視
  • 最近回覆由 cor-el

more options

I am developing some html and javascript applications. During testing I use the windows.alert box to show some innerHTML values. This worked fine, until after a while, the Alert box window size changes to a small window, showing only the horizontal slider.

I have restarted the browser, but that didn't change anything.

What can I do to have the full Alert window back?

Thanks for your help, Jan

I am developing some html and javascript applications. During testing I use the windows.alert box to show some innerHTML values. This worked fine, until after a while, the Alert box window size changes to a small window, showing only the horizontal slider. I have restarted the browser, but that didn't change anything. What can I do to have the full Alert window back? Thanks for your help, Jan

所有回覆 (7)

more options

Hi Jan, dialog sizes might be stored along with window dimensions in the same settings file. It's JSON, so in theory it's editable, but we usually suggest renaming it and having Firefox build a new one. Here's how:

Open your current Firefox settings (AKA Firefox profile) folder using either

  • "3-bar" menu button > "?" Help > Troubleshooting Information
  • (menu bar) Help > Troubleshooting Information
  • type or paste about:support in the address bar and press Enter/Return

In the first table on the page, on the Profile Folder row, click the "Open Directory" button. This should launch a new window listing various files and folders in your systems file browser.

Leaving that window open, switch back to Firefox and Quit.

Pause while Firefox finishes its cleanup, then rename xulstore.json to something like xulstoreOLD.json.

Start Firefox back up again. Do windows and dialogs display normally again?

That mini-reset may hide the bookmarks toolbar. You can use one of these methods to show the toolbar list and select the desired bars there:

  • right-click (on Mac Ctrl+click) a blank spot on the tab bar (or the "+" button)
  • (menu bar) View > Toolbars
    On Windows, tap the Alt key to activate the menu bar temporarily.
  • in Customize mode > Toolbars button (see: Customize Firefox controls, buttons and toolbars)

To turn on the Bookmarks Toolbar click it on the list.

more options

Hello, Thanks for the help so far. However, it did not solve my problem. After renaming xulstore.json to xulstoreOLD.json, I have started up Firefox again and did my test but the result is the same. See attached picture to see the result of innereHTML in the alert box. Only 1 line of data is displayed along with the horizontal scroll bar, I assume that the nr of displayed lines is not enough to show the vertical scroll bar.

Thanks a lot in advance for your suggestions, Jan

more options

Hi Jan, I do not know what is causing that. I can't think of any way to restrict the height through a setting. ??

more options

I've experienced issues like that as well at various occasions. Best it put a long line at the top of the message and make sure that you have line breaks (\n) in the message or at least spaces, so Firefox can wrap text.

more options

Also make sure that the Firefox window is large enough (try full screen) as this is tab modal.

more options

Thanks for your tips.

I have put extra line breaks and line count in the alert stmt. Nothing helps so far. see attached alert statement and result on a maximized the window.

Thanks a lot in advance for your help, Jan

more options

What works best for me in case of issues it to make the first line very long. alert("--------------------------------------------------------\n"+document.getElementsByTagName("body")[0].innerHTML);

You want to show html content in an alert and that may not always work out well as in a lot of cases this can be one long line that isn't really suited for displaying in an alert. An Alert prompt also has a maximum for what is displayed and is cut off beyond that. I usually use a prompt where both arguments have this content as there is no limit for the content in the prompt part.

In the current release it works fine with the HTML code of this page.

  • alert("HTML code:\n"+document.getElementsByTagName("html")[0].outerHTML);
  • prompt("HTML code:\n"+document.getElementsByTagName("html")[0].outerHTML,document.getElementsByTagName("html")[0].outerHTML);

You can possibly parse the content and break long lines.