在iOS上的Safari中,当<audio> DOM元素正在播放声音文件时,您可以通过设备锁定屏幕暂停/重新启动它.
问题:当用户单击该锁定屏幕上的下一个或上一个按钮时,是否有可以在<audio>元素上侦听的事件?
奖励问题:在Safari中通过HTML5和Javascript,有没有办法像在应用程序中一样在锁定屏幕上显示音频文件的元数据?
我正在尝试在Google Analytics中获取setAllowAnchor标记以记录广告系列信息,但它似乎无法正常工作.
我正在尝试使用它的网站使用hashbang风格的网址BTW - 这http://hostname/#!/relative-url是导航风格,因为需要跨页面视图的持久音频播放器.
我已尝试过以下两种方法,但我没有setAllowAnchor在GA中看到任何广告系列.
/#!/&utm_campaign=setAllowAnchor&utm_medium=hash&utm_source=test
/#utm_campaign=setAllowAnchor&utm_medium=hash&utm_source=test
Run Code Online (Sandbox Code Playgroud)
不推荐使用函数setAllowAnchor.我究竟做错了什么?
我的Google Analytics代码如下所示:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1060190-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
_gaq.push(['_setAllowAnchor', true]);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
Run Code Online (Sandbox Code Playgroud) 我正在尝试编写我的第一个浏览器扩展程序,但似乎无法通过单击上下文菜单项来触发单击处理程序。console.log 调用似乎没有向控制台输出任何内容,我尝试使用 alert() 以防万一“背景”脚本(不确定背景和内容脚本之间的区别究竟是什么),但是似乎也没有做任何事情。
当我在测试页面的输入中选择一些文本时,右键单击并选择加密或解密,没有任何反应;不在控制台或开发人员工具的网络选项卡中。我究竟做错了什么?
manefest.json:
{
"manifest_version": 2,
"name": "my name",
"description": "my description",
"version": "1.0",
"background": {
"scripts": ["jquery-3.2.1.min.js", "background.js"],
"persistent": false
},
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["content_script.js"]
}
],
"permissions": [
"activeTab",
"contextMenus",
"http://my.hostname.com/"
]
}
Run Code Online (Sandbox Code Playgroud)
背景.js:
/**
* A handler which will run the analysis of the DOM element's selected text
*/
function clickHandler(info, tab) {
"use strict";
console.log(info);
console.log(tab);
// get selected text as encrypt/decrypt
chrome.tabs.query({active: true, currentWindow: true}, function (tabs) { …Run Code Online (Sandbox Code Playgroud)