Ok so perhaps someone can help me with a problem I’m trying to solve. Essentially I have a JSP page which gets a list of Country objects (from the method referenceData() from a Spring Portlet SimpleFormController, not entirely relevant but just mentioning in case it is). Each Country object has a Set of province objects and each province and country
Tag: javascript
How to change the playing speed of videos in HTML5?
How to change the video play speed in HTML5? I’ve checked video tag’s attributes in w3school but couldn’t approach that. Answer According to this site, this is supported in the playbackRate and defaultPlaybackRate attributes, accessible via the DOM. Example: The above works on Chrome 43+, Firefox 20+, IE 9+, Edge 12+.
How to upload string as file with jQuery or other js framework
Using javascript, I have a file in string (got with ajax request). How to upload it as file to server by another ajax request ? Answer You need to set the Content-type request header to multipart/form-data and play around with the format a little, I wrote this in Plain Ol’ JavaScript ™ but you could easily rework it for a
How to get caller element using JavaScript?
I have a table with id “tbl” and it has 2 rows and 3 cols. Each cell (td) has an explicitly defined id. Also, the table has an onclick event that calls a function foo(). The onclick() would be generated whenever any cell is clicked. The table tag is: I also tried javascript:foo(this) I want to find out the id
AJAX Problem – No response text in FireFox, but ok in IE
I am making a simple AJAX call to an external site. It works ok in IE, but in Firefox, not response text is returned. I think it might have something to do with the response being “chunked”, but I’m not sure. Any ideas? Thanks. Answer Is your page hosted at http://drc.edeliver.com.au also? If not, then you can’t make an XMLHttpRequest
getting file size in javascript
given a path of a file like: C:file.jpg how can i get the size of the file in javascript? Answer If it’s not a local application powered by JavaScript with full access permissions, you can’t get the size of any file just from the path name. Web pages running javascript do not have access to the local filesystem for security
jQuery Youtube URL Validation with regex
I know there is plenty of question answered over here https://stackoverflow.com/questions/tagged/youtube+regex, but not able find a question similar to me. Any body has the JavaScript Regular expression for validating the YouTube VIDEO URL’s line below listed. Just want to know where such a URL can be possible — update 1– — update 2– This one worked almost fine, but failed
When iterating over values, why does typeof(value) return “string” when value is a number? JavaScript
I’m using Google Chrome for this test: Contrary to intuition, the first loop alerts “string” three times, while the second loop alerts “number” three times. I was expecting both loops to alert “number” three times. How is the first loop implemented in JavaScript? In other words, if the for-each is syntactic sugar, what is its equivalent using a standard loop?
Asynchronous Controller is blocking requests in ASP.NET MVC through jQuery
I have just started using the AsyncController in my project to take care of some long-running reports. Seemed ideal at the time since I could kick off the report and then perform a few other actions while waiting for it to come back and populate elements on the screen. My controller looks a bit like this. I tried to use
What makes an input vulnerable to XSS?
I’ve been reading about XSS and I made a simple form with a text and submit input, but when I execute <script>alert();</script> on it, nothing happens, the server gets that string and that’s all. What do I have to do for make it vulnerable?? (then I’ll learn what I shouldn’t do hehe) Cheers. Answer Indeed just let the server output