Table of Contents
回复内容:
拖放测试
Home Web Front-end H5 Tutorial nw.js 如何禁用向主窗口拖放文件?

nw.js 如何禁用向主窗口拖放文件?

Jun 07, 2016 am 08:43 AM
chrome node webkit

由于主界面其实就是 Chrome 的浏览器窗口,所以沿袭了它的一些行为,例如将外部文件拖进窗口时,node-webkit 会尝试打开文件比如如果文件是图片,那么主窗口就会直接显示出这张图片,如果不禁用这个行为的话实在太容易穿帮了。

回复内容:

著作权归作者所有。
商业转载请联系作者获得授权,非商业转载请注明出处。
作者:玄魂
链接:zhuanlan.zhihu.com/xuan
来源:知乎

其实拖放(drag-drop)操作是Html5的功能,不是nw.js的内置API,那么我们采用Html5应用一般的处理方法就可以了。

首先我们看一下一个正常的页面,直接拖放一个文件过来的效果。

页面代码:


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

<html>

 <head>

  <title>拖放测试</title>

 </head>

 <body>

  <bodystyle="background-color:rgba(0,0,0,0);">

   <pid="output">

    <h1 id="拖放测试">拖放测试</h1>

    <p></p>

    <script>

 

</script> 

   </pid="output">

  </bodystyle="background-color:rgba(0,0,0,0);">

 </body>

</html>

Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is Updater.exe in Windows 11/10? Is this the Chrome process? What is Updater.exe in Windows 11/10? Is this the Chrome process? Mar 21, 2024 pm 05:36 PM

Every application you run on Windows has a component program to update it. So if you are using Google Chrome or Google Earth, it will run a GoogleUpdate.exe application, check if an update is available, and then update it based on the settings. However, if you no longer see it and instead see a process updater.exe in the Task Manager of Windows 11/10, there is a reason for this. What is Updater.exe in Windows 11/10? Google has rolled out updates for all its apps like Google Earth, Google Drive, Chrome, etc. This update brings

What file is crdownload? What file is crdownload? Mar 08, 2023 am 11:38 AM

crdownload is a chrome browser download cache file, which is a file that has not been downloaded; crdownload file is a temporary file format used to store files downloaded from the hard disk. It can help users protect file integrity when downloading files and avoid being damaged. Unexpected interruption or stoppage. CRDownload files can also be used to back up files, allowing users to save temporary copies of files; if an unexpected error occurs during downloading, CRDownload files can be used to restore downloaded files.

What to do if chrome cannot load plugins What to do if chrome cannot load plugins Nov 06, 2023 pm 02:22 PM

Chrome's inability to load plug-ins can be solved by checking whether the plug-in is installed correctly, disabling and enabling the plug-in, clearing the plug-in cache, updating the browser and plug-ins, checking the network connection, and trying to load the plug-in in incognito mode. The solution is as follows: 1. Check whether the plug-in has been installed correctly and reinstall it; 2. Disable and enable the plug-in, click the Disable button, and then click the Enable button again; 3. Clear the plug-in cache, select Advanced Options > Clear Browsing Data, check cache images and files and clear all cookies, click Clear Data.

What is the Chrome plug-in extension installation directory? What is the Chrome plug-in extension installation directory? Mar 08, 2024 am 08:55 AM

What is the Chrome plug-in extension installation directory? Under normal circumstances, the default installation directory of Chrome plug-in extensions is as follows: 1. The default installation directory location of chrome plug-ins in windowsxp: C:\DocumentsandSettings\username\LocalSettings\ApplicationData\Google\Chrome\UserData\Default\Extensions2. chrome in windows7 The default installation directory location of the plug-in: C:\Users\username\AppData\Local\Google\Chrome\User

How to solve the problem that Google Chrome cannot open web pages How to solve the problem that Google Chrome cannot open web pages Jan 04, 2024 pm 10:18 PM

What should I do if the Google Chrome web page cannot be opened? Many friends like to use Google Chrome. Of course, some friends find that they cannot open web pages normally or the web pages open very slowly during use. So what should you do if you encounter this situation? Let’s take a look at the solution to the problem that Google Chrome web pages cannot be opened with the editor. Solution to the problem that the Google Chrome webpage cannot be opened. Method 1. In order to help players who have not passed the level yet, let us learn about the specific methods of solving the puzzle. First, right-click the network icon in the lower right corner and select "Network and Internet Settings." 2. Click "Ethernet" and then click "Change Adapter Options". 3. Click the "Properties" button. 4. Double-click to open i

How to use express to handle file upload in node project How to use express to handle file upload in node project Mar 28, 2023 pm 07:28 PM

How to handle file upload? The following article will introduce to you how to use express to handle file uploads in the node project. I hope it will be helpful to you!

How to delete node in nvm How to delete node in nvm Dec 29, 2022 am 10:07 AM

How to delete node with nvm: 1. Download "nvm-setup.zip" and install it on the C drive; 2. Configure environment variables and check the version number through the "nvm -v" command; 3. Use the "nvm install" command Install node; 4. Delete the installed node through the "nvm uninstall" command.

what does chrome mean what does chrome mean Aug 07, 2023 pm 01:18 PM

Chrome means browser, a web browser developed by Google. It was first released in 2008 and quickly became one of the most popular browsers in the world. Its name comes from the browser's interface design because of its iconic The feature is the tab bar at the top of the window, and the appearance of this tab bar is very similar to chrome metal.

See all articles