Search code examples
javascriptinternet-explorerpinned-site

javascript urls in IE pinned site task list


I'm attempting to set up Pinned Site features for my project. The trouble is that I'd like to have the tasks be javascript actions rather than loading a new page. The reason for this is that the site is designed to only ever work in a single window.

I tried adding the following META tag:

<meta name="msapplication-task" content="name=Test Action;
        action-uri=javascript:ui('test',8);icon-uri=/img/icons/test.ico" />

However this causes the task to simply not appear. (Using a normal URL makes it show up just fine)

Is there any way to do this? The best I can think of is a hash and check for the hashchange event, but this doesn't work because it gets opened in a new tab of the window...


Solution

  • This issue can be resolved by using a hash. By setting the action-uri to something readable by JavaScript, the JS can then read it, process the instruction, and then clear the hash in preparation for the next task.

    This has the advantage that it works even when the window isn't already open, since the JS will read the hash on the first load too.

    The catch is to add window-type=self to the content.