Java Script

JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, weakly-typed language used for both client-side and server-side scripting. Its primary use is in rendering and allowing manipulation of web pages. Use this tag for questions regarding ECMAScript and its various dialects/implementations (excluding ActionScript and Google-Apps-Script).

66 votes
10 answers
379 views
How To Save Canvas As An Image With canvas.toDataURL()?

I'm currently building a HTML5 web app/Phonegap native app and I can't seem to figure out how to sav

avatar
Alba
0 1 0 9
asked 07 September, 2021
66 votes
12 answers
2.3K views
How do I correctly detect orientation change using Phonegap on iOS?

I found this orientation test code below looking for JQTouch reference material. This works correctly in the i

avatar
Georgie
0 1 0 9
asked 07 September, 2021
57 votes
9 answers
2.3K views
External resource not being loaded by AngularJs

Using Angular and Phonegap, I'm trying to load a video that is on a remote server but came across an issu

avatar
Keila
0 1 0 9
asked 07 September, 2021
64 votes
5 answers
2K views
jQuery Mobile: document ready vs. page events

I am using jQuery Mobile, and I am having trouble understanding differences between classic document ready and

avatar
Tuan
0 1 0 9
asked 07 September, 2021
64 votes
3 answers
1.5K views
Why is there no same-origin policy for WebSockets? Why can I connect to ws://localhost?

I'd like to use WebSockets for inter-process communication for my application (Daemon<->WebGUI and

avatar
Shantay
0 1 0 9
asked 07 September, 2021
49 votes
5 answers
1.5K views
Sending message to a specific connected users using webSocket?

I wrote a code for broadcasting a message to all users: // websocket and http servers var webSocketServer = re

avatar
Xavier
0 1 0 9
asked 07 September, 2021
61 votes
5 answers
2.3K views
Creating a "Hello World" WebSocket example

I don't understand why I cannot make the following code work. I want to connect with JavaScript to my ser

avatar
Solomon
0 1 0 9
asked 07 September, 2021
60 votes
6 answers
2.3K views
getting the reason why websockets closed with close code 1006

I would like to get the reason websockets closed, so I can show the right message to the user. I have sok.on

avatar
Alba
0 1 0 9
asked 07 September, 2021
58 votes
7 answers
2.4K views
WebSocket: How to automatically reconnect after it dies

var ws = new WebSocket('ws://localhost:8080'); ws.onopen = function () { ws.send(JSON.stringify({

avatar
Sydney
0 1 0 9
asked 07 September, 2021
61 votes
5 answers
1.9K views
How can I get the sha1 hash of a string in node.js?

I'm trying to create a websocket server written in node.js To get the server to work I need to get the S

avatar
Luis
0 1 0 9
asked 07 September, 2021
61 votes
6 answers
2.3K views
Closing WebSocket correctly (HTML5, Javascript)

I am playing around with HTML5 WebSockets. I was wondering, how do I close the connection gracefully? Like, wh

avatar
Frederick
0 1 0 9
asked 07 September, 2021
67 votes
4 answers
1.3K views
My Understanding of HTTP Polling, Long Polling, HTTP Streaming and WebSockets

I have read many posts on SO and the web regarding the keywords in my question title and learned a lot from th

avatar
Stacia
0 1 0 9
asked 07 September, 2021
67 votes
3 answers
1K views
Sending websocket ping/pong frame from browser

I keep reading about ping/pong messages in websockets to keep the connection alive, but I'm not sure what

avatar
Stacia
0 1 0 9
asked 07 September, 2021
63 votes
12 answers
1.4K views
Send message to specific client with socket.io and node.js

I'm working with socket.io and node.js and until now it seems pretty good, but I don't know how to s

avatar
Frederick
0 1 0 9
asked 07 September, 2021
56 votes
12 answers
1.7K views
HTTP headers in Websockets client API

Looks like it's easy to add custom HTTP headers to your websocket client with any HTTP header client whic

avatar
Daniel
0 1 0 9
asked 07 September, 2021
62 votes
4 answers
2.4K views
In what situations would AJAX long/short polling be preferred over HTML5 WebSockets?

I am building a small chat application for friends, but unsure about how to get information in a timely manner

avatar
Georgie
0 1 0 9
asked 07 September, 2021
55 votes
21 answers
410 views
React Js conditionally applying class attributes

I want to conditionally show and hide this button group depending on what is passed in from the parent compone

avatar
Chelsea
0 1 0 9
asked 07 September, 2021
55 votes
13 answers
1.2K views
Invariant Violation: _registerComponent(...): Target container is not a DOM element

I get this error after a making trivial React example page: Uncaught Error: Invariant Violation: _register

avatar
Luis
0 1 0 9
asked 07 September, 2021
61 votes
16 answers
1.2K views
Setting a backgroundImage With React Inline Styles

I'm trying to access a static image to use within an inline backgroundImage property within React. Unfort

avatar
Kurtis
0 1 0 9
asked 07 September, 2021