7

We can create application shortcut in google Chrome. I would like to display a different layout when my web page is running in application shortcut mode - which basically is running in a separate standalone window.

Is there a way to tell if web page is running in application shortcut mode?

Right now I am testing if the window can be re-sized by JavaScript - assuming that it is running in application shortcut mode if the window can be re-sized.

I am wondering if there is a better way to do this.

[Update] Basically we want to know if the webpage is running in a single window or running in one tab of a window.

1 Answer 1

2

I've just googled a bit and found this site: http://blog.kenneth.io/blog/2010/05/04/desktop-icons-in-google-chrome/

You can see this <meta> element in the first code block:

<meta name="application-url" content="http://www.example.com"/>

I haven't found any reliable and offcial documentation* yet, but it seems to work in a quick test I've just made.

In that way, you could pass an extra query string to your URI which only gets called when opening from a pinned (taskbar|desktop) short cut.

*) This <meta> element is also unofficially metioned here: Page Meta Properties - mozilla f1.



How can it be used?

  • Create a new HTML document:

<html>
  <head>
    <meta charset="utf-8" />
    <meta name="application-url" content="http://www.exaple.com?shortcut=true" />

    <title>Test</title>
  </head>

  <body>
    Test
  </body>
</html>
  • Now, open this document in Google chrome (works also with local file system!).
  • Create a taskbar and/or desktop shortcut via Chrome's Tools menu.
  • Chrome will open another window with the original URI. This is possibly a bug.
    But if you use the shortcut, Chrome will open the URI provided in the <meta> tag (here: http://www.exaple.com?shortcut=true).
2
  • I'm sorry but could you tell me more clearly how does the meta tag help for my case? How do I define the meta in my html and what's the difference when it's running from shortcut?
    – Qiusheng
    Commented Jun 13, 2013 at 21:48
  • You are right! When running from shortcut, it's openning the URL from the meta tag. Thanks a lot!
    – Qiusheng
    Commented Jun 17, 2013 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.