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.)
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:
Google News
Test
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.
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.
Unfortunately, using "Add shortcut on Home screen" in the default-provided "Internet" browser produces the same result as Chrome.
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:
How can someone create a desktop shortcut to an arbitrary URL, ignoring a provided web app manifest?
Answer
- Copy the following code...
JavaScriptx: 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)
- Open Chrome on Android
- Go to the URL you want to add to your Home screen, for example...
- Paste the code copied earlier into Chrome's Location bar
- Scroll to the beginning of the pasted code
- (Touch & Drag repeatedly on the text in the Location bar to scroll it)
- Touch after the
x
inJavaScriptx
- Backspace the
x
, using whatever your Backspace button looks like on the on-screen keyboard - 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...
- 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
- 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".
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.
No comments:
Post a Comment