Tag: 谷歌浏览器

jquery-1.7.1.min.js在Google Chrome 29版本中输入文件的问题

对于我有一些奇怪的问题(在Chrome 29.0.1547.76 m版本中)jQuery jquery-1.7.1.min.js 。 如果我删除上面提到的jQuery文件包含然后file input正确显示文件打开对话框但是如果我保留它然后它显示如下错误 Uncaught InvalidStateError:尝试使用不可用或不再可用的对象。 myjavscript.js:1170 myxfunction myjavscript.js:1170 (匿名函数)myjavscript.js:1092 f.event.dispatch jquery-1.7.1.min.js :3 h.handle.i jquery-1.7.1.min.js :3 错误行是 f.event.dispatch jquery-1.7.1.min.js :3 h.handle.i jquery-1.7.1.min.js :3 有人可以帮帮我吗? 编辑:创建动态Textarea ,我使用caretPosition()操作Textarea内容。 因此,为了跟踪对Textarea所做的更改,我将以下事件绑定到Textarea。 jQuery(“#myUniqeDivId”).on(“click change keypress”, “textarea”, function(e){ … });

javascript / jquery内容旋转器变得疯狂(一段时间后开始循环非常快)

我正在使用一个非常简单的内容旋转器。 虽然它似乎工作正常,但有时候,在浏览器窗口停留在该页面上一段时间后(可能是10分钟),动画开始高速播放(就像每个“帧”仅1毫秒)。 这是我的HTML: Text Text … … 这是脚本 function tCycle() { var duration = 4000; var speed = 500; // var arrDivs = $(‘#contentRotator .cItem’); var arrLength = arrDivs.length; var iCurrent = 0; var iNext; arrDivs.not(arrDivs.eq(iCurrent)).hide(); setInterval(function () { iNext = (iCurrent + 1) % arrLength; arrDivs.eq(iNext).fadeIn(speed); arrDivs.eq(iCurrent).fadeOut(speed); iCurrent = (iCurrent + 1) % arrLength; […]

Chrome中的Bootstrap 4轮播响应问题

我在Chrome中只有Bootstrap 4轮播的问题。 这是我的代码: Previous Next 这是我的小提琴: https://jsfiddle.net/benjamin_edwards/1gx43oph/ 这是一个问题的图像: 如您所见,左侧窗格是Chrome,右侧是Safari。 只有Chrome有一个盛开的问题 – 有没有人经历过这个问题? 干杯, 本。

Chrome显示“访问控制允许来源”错误

我正在使用jquery将数据发布到服务器,服务器接收到数据,但chrome仍显示错误: XMLHttpRequest cannot load `myServer:63373/api/sendData`. Origin `myServer:63385` is not allowed by Access-Control-Allow-Origin. 这是我的js代码: $.ajax({ type: ‘POST’, url: ‘myServer:63373/api/SendData’, crossdomain: true, async: true, data: myData, dataType: ‘json’, success: function(){ alert(‘success’); } }); 奇怪的是,请求后显示“成功”,服务器确实收到了数据,但随后错误消息显示在控制台中。 有没有办法避免这个消息?

jQuery find()在Google Chrome中返回一个空字符串

我正在使用jQuery设置Ajax请求,该请求从PHP脚本中获取XML提要,然后从提要中解析一些信息并将其插入到DOM中。 它在Firefox中运行良好; 但是,在Chrome中,我得到一个title元素的空字符串。 这是Ajax请求的基本设置: $.get(‘feed.php’, function(oXmlDoc) { $(oXmlDoc).find(‘entry’).each(function() { $(this).find(‘title’).text(); $(this).find(‘id’).text(); // do other work… }); }); 对于它的价值,这里是从脚本中获取数据的PHP脚本。 我正在使用cURL,因为我正在跨域提出请求(因为这对于手头的问题来说是一个快速而肮脏的解决方案)。 $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $str_feed_url); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $xml = curl_exec($curl); curl_close($curl); echo $xml; XML数据正在正确返回,我可以看到Chrome中兄弟节点的值(例如ID ),但无论出于何种原因,我继续为title节点获取一个空字符串。 编辑:根据要求,这是相关XML的片段: http://TheAddress.com/feed/01 The Title of the Post Tom 2009-11-05T13:46:44Z 2009-11-05T14:02:19Z …

popup和content.js没有在chrome扩展中进行通信

我试图从使用chrome扩展名打开的标签中获取数据。 到目前为止,我的扩展程序可以打开一个带有正确链接的新选项卡,但是我无法获取content.js来响应单击弹出窗口中的提交按钮。 我的整个代码如下。 我真的很感激任何帮助。 popup.js $(document).ready(function(){ function d(c){ console.log(c) } $(‘#rt’).click(function(){ var mov = $(‘input:text’).val() //open new link with movie title name var movUpdate = mov.replace(/ /g,’_’) var link = “http://www.rottentomatoes.com/m/” + movUpdate chrome.tabs.create({“url”:link,”selected”:false},function(tab){ chrome.tabs.sendMessage(tab.id,{“message”:”clicked_submit”}) d(tab.id) }) }) }) 这是我的内容-js,它没有记录’弹出消息’ function d(c){ console.log(c) } chrome.runtime.onMessage.addListener( function(request,sender,sendResponse){ if(request.message===’clicked_submit’){ //find the rottentomato scores d(‘popup message’) } }); […]

fadeOut()效果在firefox上运行正常,但在chrome上运行不正常

我有一个项目列表,每个项目旁边都有一个标准的CRUD。 我在下面添加了js函数,用于删除时淡化的项目。 这种效果在Firefox上运行得很好,但在Chrome上却没有。 它确实删除了该项目,但没有显示效果。 有人可以帮忙吗? 到底是怎么回事? $(document).ready(function() { $(‘.delete_phone’).bind(‘ajax:success’, function() { $(this).closest(‘tr’).fadeOut(); }); }); 非常感谢!

$ .ajax无法使用移动设备 – 显示404

在我的网络应用程序中使用$.ajax从api获取数据…它适用于除移动设备上的chrome之外的所有浏览器…当我使用chrome控制台模拟(我选择galaxy作为设备)并检查问题很明显,在移动设备上,$ .agaxurl会返回404,但如果我将该url复制到新标签(未模拟),则不会有404 … 这是我正在打电话的。 // both of the following urls have the same results var api_url = “https://pmp.psft.co/api/v2/collections/” + collection_id + “/contents?access_token=”+token_cookie; var api_url = ‘/collections/’ + collection_id + ‘/contents.json’; $.ajax({ url : api_url, type : “get”, async: false, data: {per_page: perPage, page: currentPage}, success : function(collectionData) { build_collection(collectionData); console.log(‘success collection data’); }, error: function(){ […]

内容安全策略指令:“script-src’self”unsafe-eval’”

我正在使用urlive库来使用链接加载缩略图。 在Chrome扩展程序之外,该function非常完美。 但是在Chrome扩展程序中运行相同的function时,我收到了错误消息: “拒绝加载脚本’http://query.yahooapis.com/v1/public/yql?callback=jQuery1111091462301090359…22+and+xpath%3D%22*%22+and+compat%3D%22html5%22&format=xml&_=1417426473922’因为它违反了以下内容安全策略指令: “script-src ‘self’ ‘unsafe-eval'”. ‘http://query.yahooapis.com/v1/public/yql?callback=jQuery1111091462301090359…22+and+xpath%3D%22*%22+and+compat%3D%22html5%22&format=xml&_=1417426473922’ “script-src ‘self’ ‘unsafe-eval'”. $(document).ready(function() { $(‘#thumbnail_url’).on(‘input propertychange’, function () { console.log(‘called’); $(‘#thumbnail_url’).urlive({ callbacks: { onStart: function () { console.log(‘called1’); $(‘.loading’).show(); $(‘.urlive-container’).urlive(‘remove’); }, onSuccess: function (data) { $(‘.loading’).hide(); $(‘.urlive-container’).urlive(‘remove’); }, noData: function () { $(‘.loading’).hide(); $(‘.urlive-container’).urlive(‘remove’); } } }); }).trigger(‘input’); }); 我已经尝试了所有的可能性。 但我没有得到答案。 在调用yahooapis ,我仍然yahooapis 。

如何确保在JQuery插件中加载图像?

在创建需要图像尺寸的JQuery插件时,我发现像Chrome这样的webkit浏览器通常会为图像返回0尺寸,因为它们是并行加载的。 我的快速而肮脏的解决方案是在$(window).load()事件中包装调用我的插件的代码: $(document).ready(function() { $(window).load(function() { $(‘.magnifier’).magnifier(); }); }); 我将如何在插件内部实现此function? 什么是检测图像已加载的最干净的方法,以便我可以测量它们的尺寸?