Open rdtsc opened 8 years ago
When spawning a new window via nw.Window.open and where the target is a PDF file, the Window.loaded event is fired multiple times for the newly created window.
nw.Window.open
Window.loaded
{ "name": "nw.js", "main": "index.html" }
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Window Event Test</title> <script> function spawnWindow(path) { nw.Window.open(path, {}, function(win) { win.on('loaded', function() { console.log(path + ' - loaded'); }); win.on('closed', function() { console.log(path + ' - closed'); }); }); } </script> </head> <body> <button onclick="spawnWindow('https://google.com')">Open HTML</button> <button onclick="spawnWindow('https://stlab.adobe.com/wiki/images/d/d3/Test.pdf')">Open PDF</button> </body> </html>
Open HTML
Open PDF
Reproducible with the same results on remote and local PDF targets. That is, on both:
http*://*.pdf
file:///*.pdf
I can reproduce this issue with the above codes on Linux/Windows with nwjs-sdk-v0.21.3.
Summary
When spawning a new window via
nw.Window.open
and where the target is a PDF file, theWindow.loaded
event is fired multiple times for the newly created window.Versions
Test Case
package.json
index.html
Actions
Open HTML
Open PDF
Results
Notes
Reproducible with the same results on remote and local PDF targets. That is, on both:
http*://*.pdf
file:///*.pdf