Open document in new windows

Открытие окон и методы window

Материал на этой странице устарел, поэтому скрыт из оглавления сайта.

Более новая информация по этой теме находится на странице https://learn.javascript.ru/popup-windows.

Всплывающее окно («попап» – от англ. Popup window) – один из старейших способов показать пользователю ещё один документ.

В этой статье мы рассмотрим открытие окон и ряд тонких моментов, которые с этим связаны.

…При запуске откроется новое окно с указанным URL.

Большинство браузеров по умолчанию создают новую вкладку вместо отдельного окна, но чуть далее мы увидим, что можно и «заказать» именно окно.

Блокировщик всплывающих окон

Рекламные попапы очень надоели посетителям, аж со времён 20-го века, поэтому современные браузеры всплывающие окна обычно блокируют. При этом пользователь, конечно, может изменить настройки блокирования для конкретного сайта.

Всплывающее окно блокируется в том случае, если вызов window.open произошёл не в результате действия посетителя.

Как же браузер понимает – посетитель вызвал открытие окна или нет?

Для этого при работе скрипта он хранит внутренний «флаг», который говорит – инициировал посетитель выполнение или нет. Например, при клике на кнопку весь код, который выполнится в результате, включая вложенные вызовы, будет иметь флаг «инициировано посетителем» и попапы при этом разрешены.

А если код был на странице и выполнился автоматически при её загрузке – у него этого флага не будет. Попапы будут заблокированы.

Полный синтаксис window.open

Функция возвращает ссылку на объект window нового окна, либо null , если окно было заблокировано браузером.

url URL для загрузки в новое окно. name Имя нового окна. Может быть использовано в параметре target в формах. Если позднее вызвать window.open() с тем же именем, то браузеры (кроме IE) заменяют существующее окно на новое. params Строка с конфигурацией для нового окна. Состоит из параметров, перечисленных через запятую. Пробелов в ней быть не должно.

Значения параметров params .

  1. Настройки расположения окна:

left/top (число)

Координаты верхнего левого угла относительно экрана. Ограничение: новое окно не может быть позиционировано за пределами экрана.

Ширина/высота нового окна. Минимальные значения ограничены, так что невозможно создать невидимое окно с нулевыми размерами.

Если координаты и размеры не указаны, то обычно браузер открывает не окно, а новую вкладку.

  1. Свойства окна:

menubar (yes/no) Скрыть или показать строку меню браузера. toolbar (yes/no) Показать или скрыть панель навигации браузера (кнопки назад, вперёд, обновить страницу и остальные) в новом окне. location (yes/no) Показать/скрыть поле URL-адреса в новом окне. По умолчанию Firefox и IE не позволяют скрывать строку адреса. status (yes/no) Показать или скрыть строку состояния. С другой стороны, браузер может в принудительном порядке показать строку состояния. resizable (yes/no) Позволяет отключить возможность изменять размеры нового окна. Значение no обычно неудобно посетителям. scrollbars (yes/no) Разрешает убрать полосы прокрутки для нового окна. Значение no обычно неудобно посетителям.

  1. Ещё есть небольшое количество не кросс-браузерных свойств, которые обычно не используются. Вы можете узнать о них в документации, например MDN: window.open.

Браузер подходит к этим параметрам интеллектуально. Он может проигнорировать их часть или даже все, они скорее являются «пожеланиями», нежели «требованиями».

  • Если при вызове open указан только первый параметр, параметр отсутствует, то используются параметры по умолчанию. Обычно при этом будет открыто не окно, а вкладка, что зачастую более удобно.
  • Если указана строка с параметрами, но некоторые yes/no параметры отсутствуют, то браузер выставляет их в no . Поэтому убедитесь, что все нужные вам параметры выставлены в yes .
  • Когда не указан top/left , то браузер откроет окно с небольшим смещением относительно левого верхнего угла последнего открытого окна.
  • Если не указаны width/height , новое окно будет такого же размера, как последнее открытое.

Доступ к новому окну

Вызов window.open возвращает ссылку на новое окно. Она может быть использована для манипуляции свойствами окна, изменения URL, доступа к его переменным и т.п.

В примере ниже мы заполняем новое окно содержимым целиком из JavaScript:

Basics: How to open a document in Windows 10

Technical Level : Basic

There are numerous ways to open a document you created in Windows 10. In this article, we take a look some of the common ways you can do so.

Читайте также:  Диспетчер загрузки windows для ноутбука

Here are some of the common ways you can open a document:

  • From within the application you used to create the document.
  • From within File Explorer using Quick Access.
  • Application Jump List.
  • Using Search.

Open document from within an app

Click the File menu then click Open (if the file is already listed on the Recent documents menu, you can click it to open it immediately).

By default, the application will go to the Documents library. If the document is not listed there, use the navigation pane to browse to where the file is located.

Click the arrow next to the location if the file is located within a subfolder.

Click the folder that contains the file

Select the file then click Open

Opening a document using Quick Access in File Explorer

Another way you can open a document is using the Quick Access menu in File Explorer. If you recently worked on the document, you can quickly access it from there.

Launch File Explorer on the Taskbar or Start menu

In the Navigation pane, click Quick Access

Under Recent Files, select the document then double click it to open it.

Using Jump List

If you have your favorite apps pinned to the Taskbar or Start for quick access, they might have Jump List support. Introduced in Windows 7, this function lets you access the most recently saved files unique to the application.

Right click the application or hover it on the Start and a pop up menu will display the most recent documents. Select the document and click it.

Using Search

If you have a lot of files on your computer, a quick way to find that particular document is by using Search. Learn more in the following article.

WordPress.com

Need help? Check out our Support site, then

open document in new window

My site has many documents that I would like people to be able to open and read without downloading. I have checked the “open link in a new window/tab” option, but documents still download. Can someone please help?

documents are PDFs, .jpgs, nothing fancy.

The blog I need help with is seidenbergreading.net.

I took at look at your page at https://seidenbergreading.net/resources/videos/ and checked out some of the links. It does not look the checkbox for “open in a new window” worked on that page.

If you look at the HTML (or text editor) tab in your page or post editor, you can edit the links manually to add the code to tell it to open in a new window.

Here’s an example from one of your links:

I took the link above right from your page and added
target=»_blank»
to the inside of the link code. Make sure that you keep the quote marks in the same place as above. This tells the link to open in a new window/tab.

This should work for the .PDF, .JPG and .PNG files. The .pps files will not open in a browser window, your readers will have to download/open those.

Keep in mind that some browsers have settings that override what you set on your website, especially for PDF files. Sometimes people like to open PDF files in the browser, and sometimes they default to downloading.

I’m not 100% sure about the video files. I can force them to open/play in a new window using Safari, but not using Chrome. That might have to do with the users browser settings.

Hope this helps! Let me know if you have any other questions.

Sorry, I still don’t have this figured out.
Here’s a link to a document:
A note for readers in Australia, Canada, New Zealand, the UK

I would like it to open in a new window. This is preferable to automatically downloading the document to the visitor’s computer, which is what currently happens.

Can you show me what the HTML should look like? thanks.

The HTML for something to open in a new window is:

Читайте также:  Установочный диск все windows

A note for readers in Australia, Canada, New Zealand, the UK

As I mentioned, the decision for a link to open in a new tab/window or for the file to download automatically is a setting that the user controls in their browser. It’s not something we can control/mandate with HTML.

Using the above code will allow the file to open in a new window, for those users that permit that in their browsers. Others will use settings that will only download the files.

Hope this helps!

The topic ‘open document in new window’ is closed to new replies.

Open Excel files in new window

When I have Excel running and I double click an Excel file in Windows explorer, I’d like it to launch in a new window by default so that I can move documents to separate monitors. Is there any way to get this behavior?

15 Answers 15

I’ve had this problem too. Here’s what I did:

In Excel 2003, go to Tools -> Options -> General tab.

Make sure the option, ‘Ignore other applications’ is checked.

In Excel 2007 & 2010, Click the Office button -> Excel Options -> Advanced.

Under General, check ‘Ignore other applications that use Dynamic Data Exchange’.

It’s a bit back to front, and will work for any program not just Excel, but I middle-mouse-button click the Excel icon in the Windows 7 Taskbar and create a new instance of Excel, then open the documents in each instance of Excel.

Once your have multiple instances of Excel running you can arrange them side by side by holding down Shift and right clicking on the icon:

There are certain disadvantages to having all your workbooks opened in different windows. For one thing, if you write a formula in one workbook which references another, it will include the full file path of the other workbook. For another, copy/pasting from one workbook to another reduces the number of options available for the destination data, like keeping the column widths, etcetera. It’s possible that for your purposes those things won’t matter much, but basically if you experience any «weird» behavior when using multiple workbooks in multiple windows, you might try opening them in the same window to see if the weirdness goes away.

My preference is to leave the default behavior to open Excel workbooks in the same window, and when I want individual workbooks opened in different windows I right-click the file and select «Open in new window». In order to do that, I wrote this small utility. It’s free. Feel free to install it.

I followed the guide published here.

  1. Open regedit (win+R, regedit)
  2. Browse to HKEY_CLASSES_ROOT/Excel.Sheet.12/shell/Open/command
  3. In the tab on the right:
    • Right click on (Default) , select Modify. , append a space followed by «%1» (including quotes)
    • Rename command into command2
  4. In the tab on the left:
    • Just below the command folder (whose name is left untouched),
      Rename ddeexec into ddeexec2
  5. Browse to HKEY_CLASSES_ROOT/Excel.Sheet.8/shell/Open/command
  6. Repeat step 3 and 4
  7. If you want this to be valid also for csv files,
    Browse to HKEY_CLASSES_ROOT/Excel.CSV/shell/Open/command
  8. Repeat step 3 and 4 (or just repeat step 6 🙂 )

This worked for Microsoft Excel 2007. In case of update you might have to repeat these steps.

I personally liked this manual approach because is reversible. With respect to some of the other proposed solutions, I love the fact that you can so easily open 2 files with the same name.

Excel 2007: If you have access to edit your windows registry, here are a few registry files that add the option to open in a new instance (either by default or not) when you right-click on your files so you can use both functionalities.

There is a .reg file to ‘uninstall’ it as well. Tried and tested in excel 2007 (32-bits windows). I believe the technique is the same as in hyperslug’s answer: DDE or not.

Since hyperslug’s answer didn’t work for me, I followed «Option B» from his link and now open a new (empty) Excel from the start menu and drag’n’drop the file I want to open into the new window.

Читайте также:  Что такое спецификация windows

In Office 2013 they solved this issue. Each workbook is in its own window in Office 2013.

Gives a right click menu to open excel files in a new instance, and optionally makes it the default behavior, but still leaves the option to open it in an existing instance if the workbooks need cutting and pasting with formatting between them.

finally one regedit instruction that works for my windows 7 and excel 2010

To launch multiple instances of Excel, we change it by not using DDE to open the file. Check the «Ignore other applications that use Dynamic Data Exchange (DDE)» box in Excel -> Excel Options -> Advanced

If this does not work,for Windows Vista and Windows 7, we need to edit the registry to remove DDE completely. =============== Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs.

Question: Q: open a document in a new window

Posted on Aug 21, 2009 7:30 PM

All replies

Loading page content

Page content loaded

That feature isn’t available in Pages.

#1 You could make a copy of the existing document. Use Save as and give it a name so you’ll recognise it as the copy. Then open it and the original.

#2 Set in the preferences Back up previous version when saving. Save the original to get the backup. Open the backup and use it as the second window. Might work better than #1.

Message was edited by: fruhulda

Aug 21, 2009 10:32 PM

That may help for some situations, but it is a known big limitation with Pages compared to Word.

In Word you can display several different parts of the the same document in several separate windows, and you can split each of those windows to show different parts again.

Any change you make to any of the instances of the document are instantly displayed in all the other panes and windows.

To many of us, this functionality is not very important. However, if someone needs it, Pages is the wrong tool, and there are no workarounds to fully make it mimic Word in this respect.

Aug 21, 2009 11:33 PM

Aug 22, 2009 12:49 AM

fruhulda wrote:
Magnus, I am well of ware of that you are saying. Have I implied otherwise?

Yes, you have sinned! 🙂

But seriously, no. You perfectly described the best that can be achieved in Pages. I just wanted to stress that it is functionality that it is not worth even looking for in Pages. As you so correctly state, it is not available.

Aug 22, 2009 1:01 AM

Feature unavailable «in thebox»

This is why I wrote a script available on my idisk:

since 2009/05/04
download
For_iWork:iWork ’09:for Pages09:opentwice.zip

Yvan KOENIG (VALLAURIS, France.) samedi 22 août 2009 10:25:46

Aug 22, 2009 1:25 AM

KOENIG Yvan wrote:
Feature unavailable «in thebox»

This is why I wrote a script available on my idisk:

It is a good script, Yvan, for what it does. However, even with that script it is a long way to the full MS Word functionality. In MS Word, you can change the content in any of the open windows, and the modifications are instantly visible everywhere.

If you have a 20 page document, you can change the first page in one window, the last page in a second window and page 13 in a third window. If you change a style, the consequence of the style change is instantly visible in all three windows, so you can tell straight away if it works everywhere.

With your script, one gets just a read-only copy of the first document, as far as I can tell.

I persist: the full «New Window» function of MS Word is not available in Pages, not even with your otherwise good script.

Оцените статью