- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已在 Chrome、Firefox 和 IE(均为最新版本)上成功安装了 my crossrider 扩展程序,但浏览器按钮(尽管在所有浏览器上均已启用)仅适用于 Chrome。
后台代码似乎有效,因为我可以触发警报。
我的background.js看起来像这样:
appAPI.ready(function() {
var popupDims = {
CH: {height: 400, width: 400},
FF: {height: 400, width: 400},
IE: {height: 400, width: 400},
SF: {height: 400, width: 400}
};
if ("CHFFIESF".indexOf(appAPI.platform) !== -1) {
appAPI.browserAction.setPopup({
resourcePath:'popup.html',
height:popupDims[appAPI.platform].height,
width:popupDims[appAPI.platform].width
});
}
else {
alert('This extension is not supported on your browser');
}});
在我的 popup.html 中我有一些 javascript:
function crossriderMain($) {
// load libraries
eval(appAPI.resources.get('select2.js'));
$('[as-trigger]').click(function () {
// retrieves the information for the active tab
appAPI.tabs.getActive(function(tabInfo) {
activeUrl = tabInfo.tabUrl;
appAPI.request.get({
url: 'http://...',
onSuccess: function(response, additionalInfo) {
// show message
},
onFailure: function(httpCode) {
console.log('GET:: Request failed. HTTP Code: ' + httpCode);
}
});
});
})
$('[as-project-dropdown]').select2().on('select2-selecting', function (e) {
// some jquery code
});
appAPI.request.get({
url: 'http://...',
onSuccess: function(response, additionalInfo) {
var dataObject = JSON.parse(response);
$.each(dataObject.data, function(key, value) {
$('[as-project-list]').append('some html...');
});
$('[as-companyname]').html(dataObject.company);
},
onFailure: function(httpCode) {
console.log('GET:: Request failed. HTTP Code: ' + httpCode);
}
});}
在我的 Firefox 控制台中,我可以看到我的扩展抛出一个错误:
MyExtension <Warning: document.getElementById(...) is null Function-name: appAPI.request.get User callback>
@Crossrider 支持:我的应用 ID 是 65982
最佳答案
查看您的代码,我可以看到您没有设置浏览器操作的图标。根据 Browser Action docs ,在某些浏览器上,这对于按钮正确初始化至关重要。我使用您的代码创建了一个扩展,并使用 appAPI.browserAction.setResourceIcon 添加了图标而且按钮工作正常。
因此,从 background.js 中获取代码片段,添加图标,如下所示:
appAPI.ready(function() {
var popupDims = {
CH: {height: 400, width: 400},
FF: {height: 400, width: 400},
IE: {height: 400, width: 400},
SF: {height: 400, width: 400}
};
if ("CHFFIESF".indexOf(appAPI.platform) !== -1) {
appAPI.browserAction.setResourceIcon('logo.jpg');
appAPI.browserAction.setPopup({
resourcePath:'popup.html',
height:popupDims[appAPI.platform].height,
width:popupDims[appAPI.platform].width
});
}
else {
alert('This extension is not supported on your browser');
}});
[披露:我是 Crossrider 员工]
关于javascript - crossrider 扩展安装在所有浏览器上,但仅在 Chrome 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26465062/
我必须在 crossrider 浏览器扩展的扩展 .js 代码中使用浏览器的 localStorage 变量 如何访问 crossrider 扩展代码中的 localStorage 变量就像我想使用
如何在 Crossrider 扩展中编写弹出 HTML? 什么触发它以及如何添加图像,例如,如果您想在弹出窗口中显示带有一些文本的 Logo ,是否保留 extension.js 因为您将编写弹出 H
我已经开始使用 Crossrider 编写扩展程序,并且非常喜欢它。但我读过一些关于他们是浏览器劫持者的负面信息 - 特别是 search.crossrider.com 我不确定 search.cro
我是 Crossrider 的新手,我希望能够根据用户与页面的交互触发事件。 例如,当用户将鼠标悬停在 html 输入元素上时播放声音: extension.js appAPI.ready(funct
我正在使用 Crossrider 创建一个扩展程序,允许用户为他们正在查看的页面添加书签。 为此,我创建了一个按钮弹出窗口,单击该按钮将打开用于管理书签列表的 UI。当用户单击扩展程序的按钮时,我想将
我们正在使用 CrossRider 开发 Internet Explorer 的扩展。我们有一个从 http://jsons.[part_of_link_suppressed].com.s3.amaz
这里是crossrider toolbar extension demo的链接 click here 这是工具栏的演示,显示了整个网站。 那么解决方案是什么? 我试着改变它的CSS $('#xr-cr
我已经开发了 crossrider 扩展程序,但是当我尝试在 Internet Explorer(版本 8)中安装该扩展程序时,它会发出病毒警报并且防病毒软件不允许安装它。我还尝试在 crossrid
crossrider 侧面板只是一个 iframe(您可以使用 js 注入(inject)的 html,但我有兴趣使用 iframe 来减少对页面其余部分的干扰)。我在浏览器扩展程序和 iframe
我在 Crossrider 中有一个弹出窗口,其中有一个复选框。它看起来像这样: popup.html Enable Something 现在
我正在使用 CrossRider api 来获取打开的选项卡,使用那里的 API 我可以获取书签中链接的标题,但是使用那里的 api 我无法使用如何获取打开的选项卡中的网址标题,我只能获取 URL。
我们正在使用 CrossRider 开发 Internet Explorer 的扩展。我在 Debug模式下测试了我们的扩展,我更改了本地文件路径的基本 URL - 但保存新的基本 URL 后文件没有
我们正在使用 CrossRider 开发 Internet Explorer 的扩展。我在暂存模式下测试了我们的扩展,并且在后台和 extension.js 的函数 appAPI.ready 中出现了
我正在尝试使用 Crossrider 构建一些浏览器扩展。在页面加载之前,在呈现任何 DOM 元素之前,我需要一些代码来执行。这在 Crossrider 上可行吗? 我试过使用 appAPI.dom.
我使用 Crossrider 构建了我的扩展程序目前我所有的代码都在 extension.js 文件中。但是,在这个单一文件中维护它变得相当长并且变得更加困难。有没有办法将我的代码拆分成单独的文件并在
我的 Crossrider 插件使用 setPopup() 函数在单击 browserAction 图标时弹出窗口。 问题是,当我点击图标时,弹出窗口又长又细,无法使用。 这是它的屏幕截图......
我们正在使用 CrossRider 开发 Internet Explorer 的扩展。我们的扩展有代码向后台发送消息,后台发送回复并调用回调函数。这在我的装有 Internet Explorer 11
我需要使用扩展程序中的时间来计算浏览器。如果我可以检查浏览器是否处于事件状态,那么很容易计算时间。这在crossrider中怎么可能? var focused = true; window.onfoc
我真的尝试过搜索,所以如果这已经存在但我只是无法找到它,我事先表示歉意。 我正在尝试使用 crossrider 在弹出窗口中创建一个表单,并通过单击按钮来评估响应,然后将值返回给用户。我可以通过在 C
我正在使用 crossrider 为我的网站制作跨浏览器扩展。 这是我的页面代码(extension.js): appAPI.ready(function($) { //alert("Hello W
我是一名优秀的程序员,十分优秀!