Why is JavaScript in the query string executing?

I have an XSS situation where if a user saves a value like "<img onerror=alert(document.cookie)>" it will alert the cookie cookie when the page loads. The value is in the URL like http://mything.com?value=onerror%253Dalert%2528document.cookie%2...
more »

2017-04-18 22:04 (0) Answers

Angular 2: Simple input validation

I have a simple input that is meant for a phone number and I'd like to validate that there are only numbers and that the length is 10 digits long. <input [(ngModel)]="client.phone" class="form-input" name="phone" type="phone" [value]="client.phon...
more »

2017-04-18 21:04 (4) Answers

Why does reduce not print the first value?

I am trying to learn how to use reduce here and this will log only b,c,d ['a', 'b', 'c', 'd'].reduce(function(acc, cur){ console.log(cur); return cur; }) I don't understand what the accumulator is either. I have no idea how this works even af...
more »

2017-04-18 20:04 (6) Answers

ReactJS with Fetch on older browsers

I am implementing React JS, with Webpack and Babel. However, I am having trouble getting Fetch to work with IE 11. I have the following in my .babelrc file: { "presets" : ["env", "stage-0", "react"] } and the following in my webpack.config.js ...
more »

2017-04-18 20:04 (2) Answers

Open website link outside of Facebook app

I already found a way to detect if the page has been loaded inside of the Facebook app, which is done this way: var ua = navigator.userAgent || navigator.vendor || window.opera; if((ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1)) { ...
more »

2017-04-18 19:04 (0) Answers

Online Example (CSS of a Cube) inside React

I am trying to reproduce this cube inside of a webpage I am making using react (i am very new to react, so this question might be stupid) https://codepen.io/jordizle/pen/haIdo/ So, I created a component, which contains the HTML structure for the cu...
more »

2017-04-18 17:04 (1) Answers

dom manipulation and render tree reconstruction

Based on this article by Ilya Grigorik on render tree construction, we know that the DOM and the CSSOM are two distinct object models that are combined to form the render tree. What isn't very clear to me is what happens when the Web page is manipul...
more »

2017-04-18 17:04 (0) Answers

Why my filtering and sorting is not working?

I have an array of object event where each event has a start date and an end date. I am trying to filter the events by removing any events that are older than now. Then, I am trying to sort my events as most recent to then display them on the screen...
more »

2017-04-18 16:04 (2) Answers

Using an array for functions in javascript

I'm trying to create a program that uses an array of functions to cycle through the order of execution. I've included the program below, can somebody please suggest what i have done wrong.I have created a set of traffic lights on HTML and im trying t...
more »

2017-04-18 15:04 (4) Answers

Force a clear cache

I realised that sometimes my browser wont load the newest script when refreshing a page. Is there a solution to it? Something like a forced refresh of the ressources(html, js) being used? Oh and by the way: is there a shortcut in js to set marked te...
more »

2017-04-18 15:04 (0) Answers

Client local time on server

My client and server are on different timezone, all the date in DB are stored in UTC. We want to generate the report on the server with the client time not the UTC time. When ever new Date(UTCDate) is create UTC is converted into Server Datetime ins...
more »

2017-04-18 15:04 (1) Answers

Create new Date/Time using separate Date and Time

I have a form set-up in such a way that I collect the dates from a different input box and time from a dif var appointment_date = new Date(); var appointment_start = new Date("Mon Apr 24 2017 20:00:00 GMT-0400 (EDT)"); var appointment_end = ne...
more »

2017-04-18 15:04 (2) Answers

Stop tabbed element closing on second click

I have snippet of code that opens tabs, however I would like 1 tab to always remain open. How can I disable the second click on the tab button already open stopping the tab from closing? So referring to the fiddle, if you click 'Button 1' once, it ...
more »

2017-04-18 12:04 (3) Answers

Correct way to load config into Redux application

I need to read config.json file before my application will start. This config contains urls to my back-end services. Which will be used into redux action-creators. I have 2 approaches: fetch json and save data into state. And than get urls from st...
more »

2017-04-18 12:04 (3) Answers

PHP stream socket not working with HTML5 socket?

It seems that most HTML5 web socket example online with PHP are using the socket plugin. Is it possible to use stream_socket_server with HTML5 web socket? If yes, I am trying to build a simple socket server + client with PHP stream_socket_server fun...
more »

2017-04-18 10:04 (1) Answers