From 6f56abd9b052cd73169e69d564cc0b890b2babc8 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 7 Mar 2013 23:35:45 +0100 Subject: [PATCH] WIP: try-catch JavaScript-exceptions in banner-codes --- jquery.openx.js | 8 +++++++- openx.jquery.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/jquery.openx.js b/jquery.openx.js index 4b978b3..d02b228 100644 --- a/jquery.openx.js +++ b/jquery.openx.js @@ -417,7 +417,13 @@ /** Remove leading HTML-comments, because IE will stumble otherwise */ inline = inline.slice(result[0].length,inline.length); } - $.globalEval(inline); + try { + $.globalEval(inline); + } + catch(e) { + if (console.error) + console.error('Error while executing inline script-code: ' + e.message); + } insert_output(); // << The executed inline-code might have called document.write()! } else { diff --git a/openx.jquery.json b/openx.jquery.json index 54fb3cf..1f84139 100644 --- a/openx.jquery.json +++ b/openx.jquery.json @@ -3,7 +3,7 @@ "title": "jQuery OpenX", "description": "jQuery plugin, that loads banner-ads from an OpenX-server in an asynchronous and responsive way", "keywords": [ "openx", "adserver", "banner", "asynchrone", "responsive" ], - "version": "0.2.1", + "version": "0.2.2", "author": { "name": "Kai Moritz", "email": "kai@juplo.de" }, "licenses": [ { "type": "LGPLv3", "url": "http://www.gnu.org/licenses/lgpl-3.0.html" } ], "homepage": "http://juplo.de/openx", -- 2.20.1