java page 5 - Dave's Blog

Search
My timeline on Mastodon

pbryan-json-patch - A JSON Media Type for Describing Partial Modifications to JSON Documents

2011 Apr 20, 2:27"JSON (JavaScript Object Notation) Patch defines the media type "application/patch+json", a JSON-based document structure for specifying partial modifications to apply to a JSON document."PermalinkCommentsjson reference patch mime mimetype technical

JSONPath - XPath for JSON

2011 Apr 20, 2:26PermalinkCommentsjson xpath javascript library technical

JavaScript & .NET interop via WebBrowser Control

2011 Apr 5, 10:00

For my GeolocMock weekend project I intended to use the Bing Maps API to display a map in a WebBrowser control and allow the user to interact with that to select a location to be consumed by my application. Getting my .NET code to talk to the JavaScript in the WebBrowser control was surprisingly easy.

To have .NET execute JavaScript code you can use the InvokeScript method passing the name of the JavaScript function to execute and an object array of parameters to pass:

this.webBrowser2.Document.InvokeScript("onLocationStateChanged",
new object[] {
latitudeTextBoxText,
longitudeTextBoxText,
altitudeTextBoxText,
uncertaintyTextBoxText
});

The other direction, having JavaScript call into .NET is slightly more complicated but still pretty easy as far as language interop goes. The first step is to mark your assembly as ComVisible so that it can interact with JavaScript via COM. VS had already added a ComVisible declaration to my project I just had to change the value to true.

[assembly: ComVisible(true)]

Next set ObjectForScripting attribute to the object you want to expose to JavaScript.

this.webBrowser2.ObjectForScripting = this.locationState;

Now that object is exposed as window.external in JavaScript and you can call methods on it.

window.external.Set(lat, long, alt, gUncert);

However you don't seem to be able to test for the existence of methods off of it. For example the following JavaScript generates an exception for me even though I have a Set method:

if (window.external && window.external.Set) {
PermalinkCommentsjavascript webbrowser .net technical csharp

Using client-side storage, today. ✩ Mozilla Hacks – the Web developer blog

2011 Apr 5, 5:14A JS wrapper script that lets you use storage in IE6/7 via userData or localStorage every where else.PermalinkCommentsjavascript html web webbrowser storage technical userdata localstorage

JavaScript Garden

2011 Mar 14, 1:33A great intro to the details of JavaScript for developers familiar with other languages but only a passing knowledge of JavaScript.PermalinkCommentsjavascript tutorial programming reference technical

CommonJS, I Promise by Kris Kowal - JSConf.eu ☠ 2010

2010 Dec 14, 3:06"Join Kris for a pointed presentation on the state of CommonJS: what's done, what's being debated, and what needs to be done."PermalinkCommentsjavascript video commonjs technical kris-kowal

John Resig - ECMAScript 5 Strict Mode, JSON, and More

2010 Oct 6, 7:35Layman summary of ECMAScript 5 strict mode.PermalinkCommentsecma es5 strict js javascript json reference security technical article john-resig

JavaScript - The Evil Parts

2010 Oct 4, 2:10Billy Hoffman on web securityPermalinkCommentsbilly-hoffman javascript web technical security video presentation

Revision 60.000, first bits of the URL API and pingin’ the anchor « Peter Beverloo

2010 Sep 27, 3:08Adam Barth's URI API draft starts to appear in webkit: "One of the things Adam Barth is currently working on is an URL API. Citing it, the API can be used for constructing, parsing and resolving URLs through scripting, easening up tasks like getting and setting parameters. Today the first part landed in WebKit, which added the “origin” property."PermalinkCommentswebkit adam-barth uri url api javascript dom html html5 browser webbrowser technical

Video+html5+Popcorn.js=hyper-video - Standblog

2010 Aug 22, 4:04Demo of marked-up video with the people and places shown in the video popping up along side in real time.PermalinkCommentsvideo html html5 javascript technical mozilla

File API

2010 Aug 13, 4:38Blobs are coming and they're bring with them a new URL scheme...PermalinkCommentsblob html5 url html file api javascript technical uri guid

JavaScript InfoVis Toolkit

2010 Jul 8, 1:37Including graphs with force directed layout!PermalinkCommentsvia:mattb infographics javascript technical programming html graph chart visualization

Porn pranksters have a field day with YouTube injection flaw

2010 Jul 5, 4:23Cross-site scripting attack on YouTube over the weekend: "That turned out to be as simple as using two script tags in a row (<script><script>fun scripting stuff goes here!), as noted by F-Secure researcher Mikko H. Hypponen on Twitter—the first of the two tags would get stripped, and the second was allowed through."PermalinkCommentstechnical youtube security cross-site-scripting javascript

How Secure Is My Password?

2010 Jun 30, 11:08Come one and all from all over the web and tell me your password...PermalinkCommentssecurity javascript password tool

Speech Recognition with Javascript; speechapi.com

2010 May 17, 5:05"With speechapi.com's javascript API, it is possible to build interesting speech-web mashups that include both speech-to-text as well as text-to-speech."PermalinkCommentsapi javascript speech speech-to-text technical

FBJS - Facebook Developer Wiki

2010 May 6, 7:25Another subset of javascript and DOM access to make a sandbox: "FBJS is Facebook's solution for developers who want to use JavaScript in their Facebook applications. We built FBJS to empower developers with all the functionality they need, and to protect our users' privacy at the same time."PermalinkCommentssandbox web browser facebook html javascript technical security web-sandbox

google-caja - Project Hosting on Google Code

2010 May 6, 7:22"Caja allows websites to safely embed DHTML web applications from third parties, and enables rich interaction between the embedding page and the embedded applications. It uses an object-capability security model to allow for a wide range of flexible security policies, so that the containing page can effectively control the embedded applications' use of user data and to allow gadgets to prevent interference between gadgets' UI elements."PermalinkCommentssecurity web browser web-sandbox caja google javascript html technical

WebSandbox - Microsoft Live Labs

2010 May 6, 7:16"Today web gadgets, mashup components, advertisements, and other 3rd party content on websites either run with full trust alongside your content or are isolated inside of IFrames. As a result, many modern web applications are intrinsically insecure, often with unpredictable service quality. Live Labs Web Sandbox addresses this problem."PermalinkCommentsweb browser web-sandbox technical javascript html windows live security sandbox microsoft silverlight

ADsafe

2010 May 6, 7:14"ADsafe defines a safe subset of the JavaScript Programming Language, and an interface that allows programs written in that language to usefully interact with a specific subtree of of the HTML document."PermalinkCommentstechnical ajax javascript json security advertising ad web browser web-sandbox

Code Standards | Isobar

2010 May 2, 3:14"This document contains normative guidelines for web applications built by the Interface Development practice of Isobar North America (previously Molecular)." Glad to see coding styles and best practices for HTML, CSS, JS, associated HTTP headers etc etc etcPermalinkCommentscode css html html5 javascript web browser programming development technical via:kris.kowal
Older EntriesNewer Entries Creative Commons License Some rights reserved.