3

Goal: Have a desktop shortcut that opens https://news.google.com/news/i#0 , ignoring the contained web app manifest that otherwise "overrides" the saved shortcut to http://news.google.com/news?sapa=1 and with "display": "standalone".

I had this working previously on an older Android phone before a replacement / upgrade.

Prior to the upgrade, I was able to long-press and open individual articles in new tabs - as well as copy link shortcuts to specific articles, as well as all of the other features and functionality that Chrome has to offer. Here is just a partial selection of references of other users complaining about the same:

Using https://news.google.com/news/i#0 provides a temporary successful work-around. However, I can't find a successful way to add a link for this to my home screen. The "Add to Home screen" option within Chrome instead saves a link to http://news.google.com/news?sapa=1 - and in such a way that it opens as a web application instead of a web page within Chrome:

On a desktop operating system, this would be a non-issue. (Create shortcut, enter desired URL, done.)

Attempt 1: Provide my own Manifest

So I created my own manifest - editing https://news.google.com/news/ui/resources/json/manifest.json to change the start_url attribute to https://news.google.com/news/i#0, and the display attribute from standalone to browser. I then created my own HTML page that simply contained the below - then self-hosted both on a local web server:

<html>
        <head>
                <Title>Google News</Title>
                <link rel="manifest" href="/news/manifest.json"/>
        </head>
        <body>
                Test
        </body>
</html>

However, this doesn't work: Despite the shortcut being saved with the desired name and icon, it links back to my self-hosted HTML page, and not the indicated start_url. Unfortunately, it appears that cross-domain URLs are not allowed per the manifest intent - as per https://github.com/w3c/manifest/issues/183 and https://github.com/w3c/manifest/issues/196 .

Attempt 1b: MITM website

Within the confines of my own local network, I figured I could try to man-in-the-middle (MITM) the website to temporarily provide a desired manfiest to use for addition to the home screen. Unfortunately, the website uses HSTS here, which appropriately blocks the attempt.

Regardless - this is way too much work for what should be a simple effort.

Attempt 2: Widget Bookmark

Unfortunately, it looks like the 1x1 bookmark widget was removed in Chrome 48, as per https://productforums.google.com/forum/#!topic/chrome/Ikn2YhvT98s . The suggested work-around is to use the "Add to Home screen" feature within Chrome. Goto 10 / see beginning.

Attempt 3: Use the default-provided "Internet" browser

Unfortunately, using "Add shortcut on Home screen" in the default-provided "Internet" browser produces the same result as Chrome.

Consideration 4: Use a custom app / widget

Could probably write and install a custom application or widget that could be added to the home screen to meet the goal.

Or don't re-invent the wheel, and use an existing one. Some possibilities:

Conclusion

How can someone create a desktop shortcut to an arbitrary URL, ignoring a provided web app manifest?

1 Answer 1

6

To bypass any site's web app manifest

  1. Copy the following code

    JavaScriptx:<!-- NOTE: JavaScriptx is NOT A TYPO!!! -->
    if (meta=document.querySelector('meta[name="mobile-web-app-capable"]')) meta.parentNode.removeChild(meta);
    if (mani=document.querySelector('link[rel="manifest"]')) mani.parentNode.removeChild(mani);
    void(0)
    
  2. Open Chrome on Android

  3. Go to the URL you want to add to your Home screen, for example:

  4. Paste the code copied earlier into Chrome's Location bar

  5. Scroll to the beginning of the pasted code

    • (Touch & Drag repeatedly on the text in the Location bar to scroll it
  6. Touch after the x in JavaScriptx

  7. Backspace the x, using whatever your Backspace button looks like on the on-screen keyboard

  8. Touch Go on the on-screen keyboard (to confirm/accept the URL & run it)

The JavaScript should execute on the page & it should appear to do nothing, that's fine.

Note: if the page reloads for any reason, you'll need to run the JavaScript again.

Now, try adding that page to the Home screen again.

To add the URL to the Home screen

  1. Touch Chrome's on-screen "3 dots menu" (on the right of the Location bar, next to the "open tab count" button) or use the hardware menu button
  2. Touch Add to Home screen

It should end up as a normal Chrome link, not as a Web App, since the JavaScript nuked the page's preference for "web app mode".

Questions / Comments?

Why did you have me copy JavaScriptx just to have me backspace the x off later?

Because, in my testing, on my phone, when I pasted anything with JavaScript: at the beginning, Chrome ripped that part off, leaving only the text after it.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .