异常大的WebKit通知

lau*_*iys 5 javascript jquery notifications webkit google-chrome-extension

我正在开发Chrome扩展程序,我注意到Chrome开始对我的通知做一些奇怪的事情.

图表A.

我在谈论巨大的空白事物(通知高度应该在蓝色条结束).

它不像以前那样,它开始在新的Chrome版本的某个地方发生.

无论如何,这可能是什么原因?

扩展源代码位于http://github.com/Maxorq/LastPlug

最有趣的部分是:

JS/notifications.js

$('#title').html(decodeURIComponent($.url().param('title')));
$('#message').html(decodeURIComponent($.url().param('message')));
$('#avatar').attr('src', $.url().param('avatar'));
$('#color').addClass("color_" + $.url().param('color'));
Run Code Online (Sandbox Code Playgroud)

notification.html

<div id="content">
<img id="avatar" width="32" height="32" src="img/icon.png" />
<span id="title">Title</span><br />
<span id="message">Message</span>
</div>
Run Code Online (Sandbox Code Playgroud)

JS/background.js

var notification = webkitNotifications.createHTMLNotification('notification.html?title=' + title + '&message=' + message + '&avatar=' + avatar + '&color=' + color);

notification.show();
Run Code Online (Sandbox Code Playgroud)

我从这里使用jQuery URL Parser:https://github.com/allmarkedup/jQuery-URL-Parser

代码有点复杂,所以我不会在这里粘贴所有代码; 想知道是否有其他人有巨大的通知相同的问题.

haw*_*con 3

我不确定这是否适用于您的情况...但是每当我在 chrome 中遇到带有大空白空间的错误时,添加<!doctype html>标签而不是仅仅<html>解决问题。不知道为什么,但确实如此。希望这可以帮助:)