1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-03 14:59:57 +00:00

Fix error opening new windows with popup-blocker (#3515)

this prevents errors when a popup blocker blocks opening a new window from within a running TW
This commit is contained in:
BurningTreeC 2018-11-06 14:54:00 +01:00 committed by Jeremy Ruston
parent 3592333cb8
commit 457f03798c

View File

@ -33,8 +33,16 @@ exports.startup = function() {
height = paramObject.height || "600", height = paramObject.height || "600",
variables = $tw.utils.extend({},paramObject,{currentTiddler: title}); variables = $tw.utils.extend({},paramObject,{currentTiddler: title});
// Open the window // Open the window
var srcWindow = window.open("","external-" + title,"scrollbars,width=" + width + ",height=" + height), var srcWindow,
srcDocument;
// In case that popup blockers deny opening a new window
try {
srcWindow = window.open("","external-" + title,"scrollbars,width=" + width + ",height=" + height),
srcDocument = srcWindow.document; srcDocument = srcWindow.document;
}
catch(e) {
return;
}
windows[title] = srcWindow; windows[title] = srcWindow;
// Check for reopening the same window // Check for reopening the same window
if(srcWindow.haveInitialisedWindow) { if(srcWindow.haveInitialisedWindow) {