Weinre breaks window.sessionStorage.setItem - javascript

Ran into a weird one now.
On FireFox 30.0,when I include weinre in my html 5 page (for a hybrid mobile application), window.sessionStorage.setItem is suddenly not a function any more (or does not exists or something).
Remove weinre script, and all is fine again.
In the actual Android web container on the mobile device, it seems fine again.
So, not a train smash, but very annoying.

Probably best to create an issue on Jira, if this is still a problem.
I'd be happy to do that for you, but would like to have a better description of the problem; was an error thrown when you tried to access sessionStorage? Or did it happen even though you never tried to access sessionStorage?

Related

Debugging css and javascript on different devices

When I resize my browser on my mac, on any resolution it looks well, but when I'm on a older tablet of mine, the website looks so messed up.
What is the best way to capture that device info? So I can replicate on my machine? I still don't know is it a javascript or a css issue. How is this usually done?
Edit:
By the info I got so far, there is no tool that you can install on your device. Which would act as some kind of console where you could see, debug and interact errors like a js resource didn't load, unknown css property or any other error that you're able to see as a web developer in a chrome console for instance
Answering the question from some of the comments, so it's more visible to other people having the same issue :
You should be able to use remote debugging. You will need to use Safari on the desktop. I am not sure if you are restricted to Mac however... moduscreate.com/enable-remote-web-inspector-in-ios-6 The same also exists for Chrome/Android devices and developer.telerik.com/featured/… – xxcezz
Try modern.ie/en-us/tools not sure if it's useful. http://caniuse.com .
my best guess that would be iPad 1, running IOS 4/5. http://webdesign.tutsplus.com/articles/quick-tip-using-web-inspector-to-debug-mobile-safari--webdesign-8787

App unresponsive when javascript-profiling them

For a while I've been trying to run a JavaScript CPU profile of some applications I've developed, but everytime I start running the JavaScript CPU profiler in Chrome Dev tools, the application will stop responding at all (same as the profiler).
However, I noticed that this is not specific to my application, since I've been able to reproduce the same problem in other popular applications like Travis-CI.
I've been suspecting of extensions and plugins, but running without them doesn't seem to make a different -- the problem persists.
I've tested simpler apps with the same technology (the To-Do MVC example built in EmberJS) and that profile works just as fine.
I'm currently using Chrome 40.0.2214.111 m (64-bit).
Any idea on what the problem may be?
Update: I've tested both under incognito and guest browser mode. I thought the guest browser made a difference because I was able to profile my application once without problems. However, trying that again proved that the problem still persists.
Furthermore, I've found that the freezing time does not seem to be related with the application itself. Sometimes it'll hang when I focus an element, sometimes when I move around, some other times when I am in the middle of writing into a textbox. There seems to be nothing specific about the functionality of the app that's triggering this.
I've also tried disabling most extensions, without luck. I'll try disabling plugins as well and run as bare of a Chrome as possible.
Update 2: I've disabled all plugins and extensions completely, but the problem persists. I've also let the session go on to see if it eventually recovers. After around 2 hours, it was in the same situation. No bigger CPU consumption nor memory consumption, and other Chrome instances or tabs worked perfectly fine. I was able to close the developer tools but not interact with the original page anymore.
Update 3: I've just upgraded to Chrome 41 because it has been released in the stable branch, and I know it does include a few more things in the profiling section. I tried again and it didn't seem to make any difference.

setInterval in Android Default Browser on Galaxy S4 (Android 4.2.2)

We just got hold of a Samsung Galaxy S4 for testing our mobile website (running latest Touch-Wiz Android 4.2.2 - build JDQ39).
Straight away we noticed some major issues in our site. After some investigation, I discovered that this seems to be due to window.setInterval(fn, repeatInterval) not repeating, and only calling the passed function once.
Please note, there probably isn't a problem with our usage of setInterval, as our code works on all our other devices (lots), the chrome browser on the same device, and on desktop browsers.
I've searched, but can't find any mention of this problem. It seems bizarre to me that such a major bug would not have generated more noise.
My question is: Has anyone else seen this problem? Is it the default browser on 4.2.2, or a Touch-Wiz specific problem? Did you find an elegant work-around?
I've come up with a work-around using self-perpetuating setTimeout(s) but it's a bit nasty, and I'd rather not have to do it like that.
Turns out it wasn't actually setInterval's fault at all. Weirdly enough eval.call(window, 'some js'); seems to stop all intervals from working on this particular browser. Really don't understand how. This is the only phone we've seen it on - it doesn't happen on the stock browser on the S3 (Android 4.2.1).
P.S. The only reason we're doing eval.call is to allow make banner ads which use document.write to add scripts in a one page dynamic loading app. I'd much rather it wasn't there.

IE9 dynamic-page JS issue

I've created a page which utilizes dynamic page loading with JS, it works fine in Safari, FF and Chrome - But of course the infamous Internet Explorer isn't doing a good job.
(I know there are other issues on this page, under the "Cykler" section, these aren't important for this question and shouldn't be focused at)
http://soegaardcykler.dk/beta
Try clicking on one of the categories, Cykler, Info and so on.
The strange thing is that if I open developer tools in IE and set the mode to IE8 and back to IE9 there is no issue, it switches pages like any of the other browsers.
If I close and open IE again the issue is back - If I go to the console to check what's going on it asks me to refresh the page - When I do this the issue is gone again.
I have no idea what the heck is going on, two of my friends have tested as well and they both have the issue when coming to the page for the first time.
I notice you're logging to a console. That's problematic in IE. The console object only shows up if the console is actually open (I think).
There are several solutions out there to avoid console issues; I can't recommend a best practice though besides creating your own logger object (which isn't a bad idea anyway).
Just a side node: I don't know if you're using a Windows operating system, but if you're familiar with the Fiddler2 HTTP traffic analyzer, you can search through sessions really easily. That's how I found the file you missed.
One last edit: here's a good related post: What's the correct way to write to the script console (console.log) in IE?

PhoneGap Android Querystring issue

I seem to be having a issue using phoneGap with querystrings
I wanted to have a page as:
view.html?matchid=1234
I have also tried:
view.html#1234
Both of these work in the emulator (running 2.3) but neither work when on my phone (ICS 4.0) - It errors as if the page doesn't exists...
I believe it may be a issue with the version of android. Does anyone know of a fix/work around I could possibly do.
Ideally it would be still using the query in some way. If not the other option I thought of was to use localStorage. Save something to it before going to a generic view.html page which then takes the Id out of localStorage....
There is an issue for this in the Android issue tracker.
http://code.google.com/p/android/issues/detail?id=17535
It affects all versions of Honeycomb and ICS.
It has been fixed and marked for Future release, so don't expect it anytime soon.
You can find some workarounds on the issue thread.

Categories

Resources