window.addEventListener("onbeforeunload",function() {return "are you sure?"});
Run Code Online (Sandbox Code Playgroud)
^这似乎不起作用... ...页面将关闭而不显示确认框...
我意识到......
window.onbeforeunload = function() {return "are you sure?"}
Run Code Online (Sandbox Code Playgroud)
会工作,但我想添加功能(例如添加许多事件监听器到"onbeforeunload"功能)不完全重写功能!
javascript events google-chrome onbeforeunload addeventlistener
当django压缩css时,它会将输出保存到/static/CACHE/css/[filename].css中的文件中,但无论我尝试什么,css文件都会一直空白!
在我的模板中......
{% compress css %}
<link rel='stylesheet' type='text/less' href='{{ STATIC_URL }}css/deals_for_you.less'/>
{% endcompress %}
Run Code Online (Sandbox Code Playgroud)
我成功安装了django_compressor,django_appconf和versiontools我成功安装了lessc(testecd)STATICFILES_FINDERS已设置
COMPRESS_OFFLINE = True
COMPRESS_ENABLED = True
COMPRESS_OFFLINE_CONTEXT = {
'STATIC_URL': STATIC_URL,
}
COMPRESS_PRECOMPILERS = (
('text/less', 'lessc {infile} {outfile}'),
)
Run Code Online (Sandbox Code Playgroud)
还有,当我跑
python manage.py compress
Run Code Online (Sandbox Code Playgroud)
它输出......
Found 'compress' tags in:
[/my/file/path]/index.html
Compressing... done
Compressed 1 block(s) from 1 template(s)
Run Code Online (Sandbox Code Playgroud)
但是我得到的输出文件(在/static/CACHE/css/d41d8cd98f00.css)总是空的!