javascript,google-chrome,google-chrome-extension,content-scriptRelated issues-Collection of common programming errors
Jamal
javascript jquery datetime plugin twitter
I’ve built a Twitter plugin recently and was wondering if I could get some feedback on it. There is also a PHP side that grabs the actual tweets and I can post that code if it’s needed.http://jsfiddle.net/cKfDd/;(function ( $, window, document, undefined ) { /************************************* Plugin Functions *************************************/ /*************************************/ Plugin.prototype.init = function () {var params = [ ‘?user=’ + this.options.user,’&limit=’
adambender
javascript best-practice
I come from a Java background so my desire for proper unambiguous logging is strong. I prefer using the console to using some other gui widget however, in the browser I know that I can’t always count on the console to exist or for it to have all the levels I might like. To remedy this I worked up the following console sanitizer and I was curious what drawbacks it might have.function configureConsoleLog() {“use strict”;var logMethods = [ ‘trace’, ‘debug’, ‘log’, ‘info’, ‘warn’, ‘error’ ], i;if (!
palacsint
javascript php google html5
I am newbie at JavaScript, I am using PHP to get data from a MySQL database, and use the data to drop multiple markers into google map. Please give me some suggestion to my code, really appreciate for any your advice.<?php require_once ‘Common/system_start.php’; $sql=”select * from tab_mem order by sn desc “; $result= mysql_query($sql); $data=mysql_fetch_assoc($result); $row=mysql_num_rows($result);header(“Content-type: text/xml”);// Iterate through the rows, adding XML nodes for eachwhile (
Brandon Wamboldt
javascript node.js
I’m looking for some general feedback about the layout and structure of my code. Basically just any feedback, as I’m not super happy about this code, but I’m not sure how to improve it further.’use strict’;/* jshint node: true */var fs = require(‘fs’); var os = require(‘os’); var nodemailer = require(‘nodemailer’); var rimraf = require(‘rimraf’); var config = require(‘../config’); var dropbox = require(‘../lib/dropbox-sync’); var mysql = require(‘../lib/mysql-back
user2456359
php javascript wordpress
I’m struggling with adding the jQuery to the templated I transfered to WordPress, From what I’ve already learned from WordPress you need to use WordPress functions to include js files, is that always neccasary? Could somebody please take a look at the function I’ve written?header.php<!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta http-equiv=”Content-Type” content=”<?php bloginfo(‘HTML_type’);?>” charset=”<?php bloginfo( ‘charset’ ); ?>”
Fran Verona
php javascript jquery ajax
I have a PHP file with the following code:<html><head><!– HEAD –><?php require_once ‘Language.php’; ?></head><body><script type=”text/javascript”>$.get(‘step2.php’,function(data){// Do something});</script></body> </html>As you can see, I’m trying to load some content via Ajax call. The problem is that step2.php contains some PHP code:<div class=”step-content table-bordered”><h3><?php echo $Lang->get(‘create_s2_title
Sean
javascript node.js gruntjs livereload
PC Specs: Windows 7 Enterprise x64I’m running grunt.js on a project and recently started receiving an error when attempting to run ‘grunt watch’.Grunt worked fine yesterday but today I started seeing:Running “watch” task Waiting…Fatal error: listen EACCESI read another question here: Cloud 9 and Grunt.jsthat lead me to remove ‘options: {livereload: true}’ from Gruntfile.jsrunning watch again works as intended. Is there a way to reconfigure grunt or livereload to get livereload working with G
Asenar
javascript php jquery callback
i have make an php editor with so much effort but i cant print the fatal error. and want to print the fatal error. How to do this. I have code for run the php through eval function here is my jsfiddle – **http://jsfiddle.net/3c7F6/3/** I want to print an fatal error. Please help me to do this.please check the code and give me the suggestion
Septagram
javascript fatal-error
Is it possible to terminate script on a certain condition with a specific error message? Exceptions are not an option, as they can be catched, thus avoiding termination.Update:I’d prefer the universal approach, but if there’s none, then it’s for the in-browser JavaScript. Error should be silent, and the error message should only go into the browser error log.
Ates Goral
javascript gruntjs
I removed the old grunt first,and I install the new grunt.But I got an error:D:\www\grunt-test\grunt grunt-cli: The grunt command line interface. (v0.1.4)Fatal error: Unable to find local grunt.If you’re seeing this message, either a Gruntfile wasn’t found or grunt hasn’t been installed locally to your project. For more information about installing and configuring grunt, please see the Getting Started guide: http://gruntjs.com/getting-startedIs there haven’t a grunt in my system path, or somethi
TomKat
kubuntu google-chrome
I got an issue concerning Chrome. It launches now perfectly – still trying to install something else i see -You might want to run ‘apt-get -f install’ to correct these: The following packages have unmet dependencies:google-chrome-stable : Depends: lib32gcc1 (>= 1:4.1.1) but it is not installableDepends: lib32stdc++6 (>= 4.6) but it is not installableDepends: libc6-i386 (>= 2.11) but it is not installable E: Unmet dependencies. Try ‘apt-get -f install’ with no packages (or specify a solu
user2658948
javascript google-chrome firefox google-closure
I have a form which I need to dynamically populate the labels of (which was generated with Google Closure). I got it working in chrome, but when I tried it in Firefox it wouldn’t work, and fails with the following error:TypeError: this.document.getElementById(…)[$i].labels is undefined ….document.getElementById(‘dialog-form’)[$i].labels[0].innerHTML = “$” + varNewPr…Examining through the Firebug console I get the following error:>>> this.document.getElementById(‘dialog-form’)[4]
java_enthu
google-chrome ant selenium junit webdriver
I have a test class, all the tests of this class runs fine if I run in eclipse. (right click on the file , run as jUnit) but when I am trying to run using Ant Script it fails. Actually this test is to be run against 2 browsers. This test runs fine against IE Chrome. It runs fine against IE. But test is not able to run against Chrome. I am not sure what’s happening. All the driver related information I have placed under allresources/drivers/ of the project path. And browser profiles i have kept u
Saran
ruby google-chrome selenium
I’m trying to run a ruby file which will start chrome driver using selenium webdriver. I have selenium standalone server 2.35.0. and chromedriver executable installed. I’m starting the server by running, java -jar ./selenium-server-standalone-2.35.0.jar -Dwebdriver.chrome.bin=/usr/bin/google-chrome -Dwebdriver.chrome.driver=/home/./chromedriver &Two sessions are starting and the chrome driver fails to start. 05:07:34.328 INFO – Executing: [new session: {platform=ANY, javascriptEnabled=tr ue,
Mark Mayo
javascript security firefox google-chrome clipboard
since I have looked around and could not find any nice solution for copying text on firefox or chrome to clipboard. However, I have tried some codes provide by firefox in its developer site, but still not work and there was one errror with permission denied. Here is the code I tried the last minute. var copytext = “Text to copy”; var str = Components.classes[“@mozilla.org/supports-string;1”].createInstance(Components.interfaces.nsISupportsString); str.data = copytext; Does anyone ha
Andrew Thompson
java google-chrome exception japplet invocationtargetexception
I’m developing a Django site with an applet Java.Some days ago the applet start to fail loading in my chrome browser. I was still in developing and I tought that was a cache problem, so to test I started to use firefox.At today the applet is developed at 90%, and on firefox works smoothy. No problems at all.So I was working on some JS and I opened chrome (like its debugger), so I cleaned the chrome’s cache folder and the java plugin cache, and I open the site.The applet failed to load. Here is t
CodesInChaos
parsecool
php android google-chrome http-headers content-disposition
I am using Nexus 7 to test, any other platforms don’t have same situation as far I can test on. I use handle.php to handle the download, before echo the file content, I used:header(‘Content-length:’ . $row[‘size’]); header(‘Content-type:’ . $row[‘mime’]);and header(‘Content-Disposition:inline; filename=”‘ . $row[“file_name”] . ‘”‘);then I use android to download the file, the file name is however handle.pdf, if I change the last row of my code into header(‘Content-Disposition:attachment; filenam
user3050963
javascript jquery html html5 google-chrome
I want to implement navigation in a website using the middle button function of scrolling (“clicking” (please re-read clicking) the middle button and roaming around the borders) but I would like this to happen instantly without the need for user input. Something of the kind:$(element).mouseover(function(){roamAround(); //I’ve tried SIMULATING (NOT <— DETECTING)//a middle-click from the mouse but failed });I am currently using google-chrome and at this stage of development I am not really co
user2305193
javascript google-chrome xpath greasemonkey evaluate
so this is an xPath expression which runs fine in a Firefox userscript but fails in a (native) chrome userscript:var nodesSnapshot = document.evaluate(“//a[@class=’inline-object’ and .[contains(@href,’test.com’)] ]”, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null ); //just the string: “//a[@class=’inline-object’ and .[contains(@href,’test.com’)] ]”The error message: Uncaught SyntaxError: An invalid or illegal string was specified.I’ve tried several things (e.g. extra brackets), go
Kim
jquery google-chrome-extension
I am building my first extension and have problems getting background page loaded scripts working in content scripts, which brings doubts to if any script loaded on the background page is really available to all content scripts.I have two javascript files, functions.js and content.js, which both use jQuery. I load jQuery and the function script on the background page to decrease parsing with each site match. Once is enough as they are all functions.manifest.json NON-WORKING{“name”: “extension na
Scoregraphic
.net google-chrome-extension ipc
I have a question regarding browser remote controlling. My primary goal is to read out all open tab URLs from Google Chrome and also focus a tab if a matching URL is found and reload the current page. All this stuff is invoked from the native application (not from Chrome to the native application.Currently, I’ve tried to do with Win32-API stuff (FindWindowEx, …), new .NET Automation stuff, but this just gives me nothing (the former) or only the URL of the current tab (the latter).So I thought
Sean Anderson
javascript iframe google-chrome-extension cross-domain
I am developing inside of a Google Chrome Extension. In this environment, I have the ability to inject JavaScript into third-party websites after requesting the appropriate permissions. As such, I am injecting code into an iframe referencing a cross-domain resource, but am not bound by the same cross-origin security policies as would be expected in a ‘normal’ environment.The code I am executing inside of this iframe is:var requestId = window.requestAnimationFrame(function(){console.log(“Success”
Giuseppe Pes
javascript google-chrome google-chrome-extension google-chrome-app google-nativeclient
I am writing a small application to test and understand PNaCl.The aim of the application is to resolve an host name a the ip of an host using HostResolver class from PNaCl framework. The code seems to work properly but I am getting an access denied error (return value -7) because I haven’t asked the permission to access the socket layer (I guess) to the user. The problem is that I have no idea how to do so. I trie to write a manifest file, but nothing happened. Note : this application must run o
UserABC
c++ google-chrome-extension google-nativeclient
I am trying to create an Extension for Google Chrome ,in which I want to process some images. The extension was previously created using NPAPI ,but that being phased out need to switch to another alternative, Native Messaging looked like the best suited for this job. The native host is written in C++ and it reads from stdin a formated message sent from extension(some like {action:”name_of_action”,buffer:”x0x0″,length:”4″} ),parse it ,extract the buffer and do some processing with the image,after
Brock Adams
google-chrome google-chrome-extension greasemonkey
My goal is to use a Greasemonkey-style user script in Google Chrome to enable remembering of passwords on a specific form that has the autocomplete=”off” attribute set.Chrome’s developer tools indicate that autocomplete=”on” is being successfully set by the script, but this does not have the expected effect of allowing the storage of passwords on the form.Why doesn’t this work?ExampleChrome offers to remember passwords entered on this test page (Expected):<html><body><form action=
Zeynel
javascript scope google-chrome-extension
This question is about a similar javascript scope problem that I asked yesterday. I hope you can help me resolve this issue.I am working with a Chrome extension. options.html saves to localStorage a new user email as “user” and calls refreshUser() function in background.html://save entered gmail address document.getElementById(“save”).addEventListener(“click”, function (){var user = document.getElementById(“getEmail”).value;localStorage.setItem(“user”, user);chrome.extension.getBackgroundPage().
Methos
google-chrome google-chrome-extension
I’ve written a chrome extension in which the content script, immediately after getting loaded, talks to the background page and informs which website was loaded in that tab. But I see a very strange pattern when I search for queries in google. Let’s say, if I search for “javascript regular expressions” and first result is “w3schools.com”, then my background page reports that content script sent “google.com” and then “w3schools.com”. Out of this, the first reporting is expected since I am searchi
Mathletics
javascript google-chrome-extension
In this instance, I load a single paypal page, in which I am prompted to login. Once I login, the page changes, through the use of other javascripts on paypal’s end. The address does not change on this transition, nor does the source code in any material way. I am trying to find a way to have my script wait long enough after the first click to be able to get the element that loads after. I thought I could do this fairly simple using the following:document.getElementById(“submitLogin”).click(
Braiam
javascript google-chrome google-chrome-extension
I’m having a piece of code very simple. It checks two parameters. If first parameter is false it change the popup icon in the chrome extension, if it’s true and previously was false, then it change the icon backs and if no parameters is passed it returns the current values.The problem is that either way, both the variable and the first parameter that is being passed as boolean, is interpreted as string and that produce unexpected results. Here’s my code:var status = true; var reason; function is
Uri
javascript google-chrome-extension content-script
I have a chrome content script running on a few pages, with a console.log (and nothing else). I’ve noticed that on one page the script doesn’t run (no console output). The only thing different about this page is that its original code runs with an error. Can this be the reason the content script does not run on this page?Is there a way to make it run in spite of the error?
Brock Adams
jquery google-chrome-extension content-script
As mentioned in chrome extension development tutorial I can include jQuery in my manifest.json file to use it in a content script like so:”content_scripts”: [{“matches”: [“http://www.google.com/*”],”css”: [“mystyles.css”],”js”: [“jquery.js”, “myscript.js”]}],I did that. But when I open the javascript console and click on the browser action icon of my extension, I see the error: “Uncaught ReferenceError: $ is not defined”.What should I have to do!? I can’t understand what’s wrong.Updates from OP,
tempcode
javascript google-chrome google-chrome-extension content-script
I want to let the user decide when they want to run a script, so that when the browser opens, the “off” icon is showing and no script runs; but when the user clicks it, it changes to an “on” icon and executes a userscript, until the user clicks off. I have two png icons which are 32×32 each: on.png and off.png.My two questions:How can I set the default icon to my off.png? I tried this in my manifest.json but it didn’t set the icon, instead showed a puzzle piece (I presume a default):… “browser
user1335906
firefox-addon firefox-addon-sdk content-script
I created an add-on using add-on builder. I attached a content-script to the pageMod in main.jsMy content script counts the number of dynamic tags created using document.createElement(). This is done by creating a hook to document.createElement() and added this function to webpage by creating a script tag. My code is as follows.contentscriptFile:addJS_Node (“var count=0;”); function LogDocCreateElement () {var oldDocumentCreateElement = document.createElement; document.createElement = function
Rob W
google-chrome-extension content-script
In my extension I need to transfer some data from one tab’s content script to another tab’s content script. How can I choose certain tab using chrome.tabs, if I know a part of that tab object’s name or url in it? How can two tabs’ scripts communicate?UPDATE:Apparently I don’t have method sendMessage in chrome.extension. When I run the following from content script: chrome.extension.sendMessage(“message”);I get in console:Uncaught TypeError: Object # has no method ‘sendMessage’
Morgan
google-chrome background messaging content-script
Let me explain the problem. I’m developping a chrome extension and I’m stuck with a little functionnality. I need to grab the url in the browser and retrieve something from my server to update the badgeText.contentscript1.jschrome.extension.sendMessage({method:”sendUrlInBrowser”,urlinbrowser: location.href}, function(response) { });contentscript2.jschrome.extension.sendRequest({method: “getInfosUser”}, function(response) { var url = location.href; var id_user = response.id_user; var default_frie
Ali Esmailian
google-chrome google-chrome-extension content-script
I have created script.js with content_script.js to add button to a pageContent_script.jsvar s = document.createElement(‘script’); s.src = chrome.extension.getURL(“script.js”); s.onload = function () {this.parentNode.removeChild(this); }; (document.head || document.documentElement).appendChild(s); and in script.js add button with onclick event.var someDive = document.getElementsByClassName(“someClass”)[0]; var button = document.createElement(“button”); button.setAttribute(“onclick”, “doSomeThing(
Brock Adams
javascript jquery jquery-plugins google-chrome-extension content-script
I have a small JavaScript file based in JS/jQuery and an additional library. It is running perfectly as independent files, but I am having problems getting it up and running in a Chrome extension.The script checks each image of an HTML page for specific characteristics, and depending on that adds a border around the image.manifest.json{“name”: “ImageId”,”version”: “0.1”,”manifest_version”: 2,”browser_action”: {“default_icon”: “icon.png”},”content_scripts” : [{“matches” : [“http://*/*”,”https://
FractalBob
javascript google-chrome-extension content-script
My extension is supposed to load a content script, searchTopic.js, only after the page it’s injected into has already fully loaded (yes, I have set “run_at” to “document_end” in the extension manifest), but in fact it’s loading before all the DOM objects have been created (the crucial ones are created via some Javascript in the page). So, the question is, how can I wait until the page’s Javascript has executed? Here’s my manifest:”content_scripts”: [{“run_at”: “document_end”,”matches”: [“https:/
Rob W
javascript google-chrome-extension content-script
I’m trying to inject a function into a webpage via Chrome extension content script by:function inject(code) {var actualCode = ‘(‘ + code + ‘)();’;var script = document.createElement(‘script’);script.textContent = actualCode;(document.head||document.documentElement).appendChild(script);script.parentNode.removeChild(script); }var myObj = person; // myObj/person is passed in from elsewhere var fn = function() {alert(myObj.name); }; inject(fn); // myObj undefinedMy issue is, since fn is a function
Web site is in building