I am having strange error in my chrome extension, I can see that for some of my users they get the next error -
Cannot call method 'getLastFocused' of undefined.
This is my code:
// In background.html
chrome.windows.getLastFocused(function(win){ });
I can't recreate this problem, I see the problem happens in chrome 9-12. Someone have idea why it happens? how to reproduce?
Edit: I have the same problem with "getAll" function
Related
Sometimes Chrome Developer Console Errors don't show the problematic code when I click on the link in the error. It just shows a blank window. I haven't found a pattern to it. Has anyone else had this problem?
I have implemented Print functionality where a new print window will open upon click of a button. Due to change in requirement, I commented it out and everything was going fine. Client wanted to have the printing functionality again. So, I just uncommented
Uncaught TypeError: Cannot read property 'print' of undefined
I cleared cache, repackaged everything and redeployed. Nothing is helping me fix this. Can you please let me know where I am doing wrong.
UPDATE
Guys,
I was using the following code to print it.
myWindow=window.open(url, "myWindow", "width=2000, height=1000");
myWindow.print();
I figured out the problem. The popup was blocked. Once I allowed the popup, it worked fine.
Popup was blocked and so I was getting this error. Once I allowed the popup, it worked fine.
I am trying to use the following JQuery code:
$("#thing").on("click", function() {
....})
And it doesn't work on Google Chrome in Windows 8, but it works in Firefox on Windows 8 and basically every other OS. Any ideas?
It works, check this: http://jsbin.com/ofuvuh/1 Probably there is some error in the code that ff ignore or maybe it's your browsers fault. Please check the chrome and ie console, probably it can helps
Try:
$("#thing").click(function ()
{
// your code here
});
Which is the same as .on('click', handler). See .click documentation.
Your code snippet looks completely fine. I assume you are using a fairly up to date version of jQuery, so most probably it is nothing to do with jQuery or the browser. I suspect there might be something wrong with the code surrounding your snippet.
As a possible solution:
In Chrome you can bring up the Console, which will tell you if there is any errors in your JavaScript (developers.google.com/chrome-developer-tools/docs/…). Open it up, refresh your page (you might see the error in the Console straight away). Or click that '#thing' and watch out for any possible errors coming up in the Console.
I'm trying to bind some functions to an event.
The following code works perfectly fine in Chrome and FF but what's the corresponding code for IE?
$this.mouseenter(function(){
console.log("inside the mouse enter handler");
});
I tried this but it didn't work in IE:
$this.bind('mouseenter', function(){
console.log("inside the mouse enter handler");
});
I need it to work in at least IE 9.
console.log or at least console will give you an error on IE... hence, your javascript will not work... try using alert...
Unable to understand what is wrong # your end.
I tried this and its working fine for me.
console.log will return a js error, if your browser's console is not open. It will happen in any browser, not only with IE. Probably you tried FF and chrome with the browser console open and IE without opening the browser console. Try opening the browser console open in IE as well / by using alert() to test your funcitonality / by directly writing the functionality that you need.
Hope it helps!!!
I came across the weirdest bug. All i wanted to do is send a form using jquery and in the callback redirect the user to another page, like:
window.location.href = "index.php?p=admin";
Which from what i can find should work in all browsers.
And it does, except in IE8/9 where it only does that after i hit F12 to show the dev console! After that i need to close the browser for the redirect to NOT work again.
Anyone know why this happens and know a better way to redirect to another local page using javascript that works in IE without being affected by this crazy bug?
Are you using any of the console. functions? They aren't defined until showing the dev console and will stop the script from executing.
Have you tried?
window.location.replace("index.php?p=admin");