meta - Dave's Blog

Search
My timeline on Mastodon

Win10 UWP WebView AddWebAllowedObject details

2017 Sep 4, 3:09

The x-ms-webview HTML element has the void addWebAllowedObject(string name, any value) method and the webview XAML element has the void AddWebAllowedObject(String name, Object value) method. The object parameter is projected into the webview’s top-level HTML document’s script engine as a new property on the global object with property name set to the name parameter. It is not injected into the current document but rather it is projected during initialization of the next top-level HTML document to which the webview navigates.

Lifetime

If AddWebAllowedObject is called during a NavigationStarting event handler the object will be injected into the document resulting from the navigation corresponding to that event.

If AddWebAllowedObject is called outside of the NavigationStarting event handler it will apply to the navigation corresponding to the next explicit navigate method called on the webview or the navigation corresponding to the next NavigationStarting event handler that fires, whichever comes first.

To avoid this potential race, you should use AddWebAllowedObject in one of two ways: 1. During a NavigationStarting event handler, 2. Before calling a Navigate method and without returning to the main loop.

If called both before calling a navigate method and in the NavigationStarting event handler then the result is the aggregate of all those calls.

If called multiple times for the same document with the same name the last call wins and the previous are silently ignored.

If AddWebAllowedObject is called for a navigation and that navigation fails or redirects to a different URI, the AddWebAllowedObject call is silently ignored.

After successfully adding an object to a document, the object will no longer be projected once a navigation to a new document occurs.

WinRT access

If AddWebAllowedObject is called for a document with All WinRT access then projection will succeed and the object will be added.

If AddWebAllowedObject is called for a document which has a URI which has no declared WinRT access via ApplicationContentUriRules then Allow for web only WinRT access is given to that document.

If the document has Allow for web only WinRT access then projection will succeed only if the object’s runtimeclass has the Windows.Foundation.Metadata.AllowForWeb metadata attribute.

Object requirements

The object must implement the IAgileObject interface. Because the XAML and HTML webview elements run on ASTA view threads and the webview’s content’s JavaScript thread runs on another ASTA thread a developer should not create their non-agile runtimeclass on the view thread. To encourage end developers to do this correctly we require the object implements IAgileObject.

Property name

The name parameter must be a valid JavaScript property name, otherwise the call will fail silently. If the name is already a property name on the global object, that property is overwritten if the property is configurable. Non-configurable properties on the global object are not overwritten and the AddWebAllowedObject call fails silently. On success, the projected property is writable, configurable, and enumerable.

Errors

Some errors as described above fail silently. Other issues, such as lack of IAgileObject or lack of the AllowForWeb attribute result in an error in the JavaScript developer console.

PermalinkComments

Tweet from David Risney

2016 Nov 2, 9:30
Parsing WinRT metadata (winmd files) is much easier than last time I tried. There's support in .NET reflection APIs https://deletethis.net/dave/2016-11/Parsing+WinMD+with+.NET+reflection+APIs 
PermalinkComments

Parsing WinMD with .NET reflection APIs

2016 Nov 2, 6:13

Parsing WinMD files, the containers of WinRT API metadata, is relatively simple using the appropriate .NET reflection APIs. However, figuring out which reflection APIs to use is not obvious. I've got a completed C sharp class parsing WinMD files that you can check out for reference.

Use System.Reflection.Assembly.ReflectionOnlyLoad to load the WinMD file. Don't use the normal load methods because the WinMD files contain only metadata. This will load up info about APIs defined in that WinMD, but any references to types outside of that WinMD including types found in the normal OS system WinMD files must be resolved by the app code via the System.Reflection.InteropServices.WindowsRuntimeMetadata.ReflectionOnlyNamespaceResolve event.

In this event handler you must resolve the unknown namespace reference by adding an assembly to the NamespaceResolveEventArgs's ResolvedAssemblies property. If you're only interested in OS system WinMD files you can use System.Reflection.InteropServices.WindowsRuntimeMetadata.ResolveNamespace to turn a namespace into the expected OS system WinMD path and turn that path into an assembly with ReflectionOnlyLoad.

PermalinkComments.net code programming winmd winrt

Gamers Messed With The Steam Sale, Then Valve Changed The Rules

2014 Jun 24, 3:51

Applied game theory 101: Valve’s Steam Summer Sale involves a meta game with teams of Steam users competing for daily prizes. On Reddit the players join together to take turns winning daily. Valve gets wise and performs an existential attack, changing the rules to make it harder for players to want to coordinate.

Still, that all the players joined together to game the system gives me hope for humanity. Its a self organized solution to a tragedy of the commons problem. Only in this case the tragedy is by design and is updated to be more tragic.

PermalinkCommentsgame video-game game-theory valve

wired: cnet: Mp3 playing retainer transmits music through your...

2012 Jul 3, 2:31




wired:

cnet:

Mp3 playing retainer transmits music through your teeth:

Bone conduction audio, retainers, and shiny hip-hop teeth grills aren’t new inventions, but tech hacker Aisen Caro Chacin had the clever idea to put them all together.

The Play-A-Grill MP3 player prototype fits in your mouth like a retainer, shines on the outside like a precious metal rap grill, and plays music through bone conduction through your teeth.

Read more

Oh man, this would have made puberty just a touch cooler. Maybe. 

PermalinkCommentshumor mp3 tech

So Listen Carefully To That Song Of The Modem | Best Of MetaFilter

2012 Jun 3, 12:43

A thread about the sounds dial-up modems used to make prompted member Devonian to recall being a fly on the wall during the development of modem speed standards

PermalinkCommentstechnical standards modem

Stuxnet Explained - Obama Order Sped Up Wave of Cyberattacks Against Iran

2012 Jun 1, 4:57

From his first months in office, President Obamasecretly ordered increasingly sophisticated attacks on the computer systems that run Iran’s main nuclear enrichment facilities, significantly expanding America’s first sustained use of cyberweapons, according to participants in the program.

PermalinkCommentssecurity politics iran nuclear virus

areasofmyexpertise: I can’t believe the dumb TED conference...

2012 Mar 5, 8:25


areasofmyexpertise:

I can’t believe the dumb TED conference made me miss seeing prominent Ragnarok denier Eliott Kalan being sprayed by with seltzer by Jon Stewart. 

PermalinkCommentshumor meta jon-stewart politics video

David Weinberger's Top Ten List of Top Ten Lists of Top Ten Lists

2012 Jan 1, 10:53PermalinkCommentshumor top-ten meta

SRU: Search/Retrieval via URL -- SRU, CQL and ZeeRex (Standards, Library of Congress)

2011 Apr 18, 4:27"SRU is a standard XML-focused search protocol for Internet search queries, utilizing CQL (Contextual Query Language), a standard syntax for representing queries."PermalinkCommentsstandards search library metadata xml uri technical library-of-congress

draft-hammer-hostmeta-14 - Web Host Metadata

2011 Apr 17, 12:51"Web-based protocols often require the discovery of host policy or metadata, where "host" is not a single resource but the entity controlling the collection of resources identified by Uniform Resource Identifiers (URI) with a common URI host [RFC3986]."PermalinkCommentshost rfc reference metadata technical

DVD Ripping and Viewing in Windows Media Center

2010 Aug 17, 3:05

I've just got a new media center PC connected directly to my television with lots of HD space and so I'm ripping a bunch of my DVDs to the PC so I don't have to fuss with the physical media. I'm ripping with DVD Rip, viewing the results in Windows 7's Windows Media Center after turning on the WMC DVD Library, and using a powershell script I wrote to copy over cover art and metadata.

My powershell script follows. To use it you must do the following:

  1. Run Windows Media Center with the DVD in the drive and view the disc's metadata info.
  2. Rip each DVD to its own subdirectory of a common directory.
  3. The name of the subdirectory to which the DVD is ripped must have the same name as the DVD name in the metadata. An exception to this are characters that aren't allowed in Windows paths (e.g. <, >, ?, *, etc)
  4. Run the script and pass the path to the common directory containing the DVD rips as the first parameter.
Running WMC and viewing the DVD's metadata forces WMC to copy the metadata off the Internet and cache it locally. After playing with Fiddler and reading this blog post on WMC metadata I made the following script that copies metadata and cover art from the WMC cache to the corresponding DVD rip directory.

Download copydvdinfo.ps1

PermalinkCommentspowershell wmc technical tv dvd windows-media-center

Web Linking IETF draft - draft-nottingham-http-link-header-10

2010 Jun 20, 1:16"This document specifies relation types for Web links, and defines a registry for them. It also defines the use of such links in HTTP headers with the Link header-field."PermalinkCommentshtml http rest url uri meta reference technical link ietf

RFC 5854 - The Metalink Download Description Format

2010 Jun 1, 6:46"Metalink describes download locations (mirrors), cryptographic hashes, and other information. Clients can transparently use this information to reliably transfer files."PermalinkCommentstechnical internet download web url xml metalink

Installable Web Apps - Google Code

2010 May 24, 6:29Installable web apps makes total sense given the Google Chrome OS: "An installable web app is a normal web site with a bit of extra metadata. You build and deploy this app exactly as you would build and deploy any web app, using any server-side or client-side technologies you like. The only thing that is different about an installable web app is how the app is packaged."PermalinkCommentstechnical web browser webapp google chrome

Beatallica - Masterful Mystery Tour

2010 May 4, 4:52Mashup of Metallica with Beatles: Beatle's melodies, Metallica style, mix of lyrics.PermalinkCommentsbeatallica metallica beatles music humor mashup

Amazon Kindle: Most Highlighted Passages of All Time

2010 May 3, 7:27Amazon has the most highlighted passages of Kindle users. Of course Dan Brown is all over that. But in 94th place of most highlighted is a passage from the 'Kindle Shortcuts' book on how to highlight passages: "Go to top Notes and Clippings (Kindle 2) To create a highlight: use the 5-way controller to highlight the content you want to clip and then press the 5-way to save your selection... Highlighted by 319 Kindle users"PermalinkCommentshumor highlight amazon kindle technical meta

Hitler tries a DMCA takedown | Brad Ideas

2010 Apr 21, 1:47So... There's Downfall a 2004 film about the final days of Hitler's life. Then folks take the most dramatic scene and parody it with new subtitles having Hitler yell about various things like his cell phone or Burning Man. It becomes a meme and meta Downfall parodies show up with Hitler yelling about the Downfall parodies. Now the studio producing the film has sent DMCA takedown notices to Youtube and many of the videos are disappearing. In response is a new Downfall parody in which Hitler issues DMCA notices to Youtube...PermalinkCommentscensorship hitler humor copyright dmca eff legal youtube video fairuse meme web internet technical

webfinger enabled for all gmail accounts with public profiles - WebFinger | Google Groups

2010 Mar 13, 5:27WebFinger is finger but for the Web...PermalinkCommentswebfinger web google finger http metadata url technical

Twitter / Mark Pilgrim: Google "rich snippets" add ...

2010 Mar 12, 2:32Google's indexer now examines HTML5 microdata and they provide a tool to test out your pages microdataPermalinkCommentshtml html5 google search microformats metadata rdf technical
Older Entries Creative Commons License Some rights reserved.