How to Make Image Viewer popup android-webapp

135 views
Skip to first unread message

J Decker

unread,
Dec 23, 2018, 2:57:44 PM12/23/18
to Chromium-discuss
So on android(and windows) there's a meta tag you can add to install that page link as a launcher/desktop icon.
https://developers.google.com/web/fundamentals/app-install-banners/

This runs chrome in an incognito mode...

doing window.open( imageDataURL, "_blank" ); used to work, but doesn't anymore.

before that I was actually doing like 

popup = window.open( "about:blank", "_blank" );
popup.appendChild( document.createElement( "img" ).src = imageDataURL );  // pseudocode

that was working in windows and android; it doesn't work anymore.

I did some digging and a new way of doing the above is

popup.document.write('<iframe src="' + text  + '" frameborder="0" onclick="window.close()"  style="border:0; top:0px; left:0px; bottom:0px; right:0px; width:100vw; height:100vh;" allowfullscreen></iframe>');

also doesn't work in incognito app.... it does work in chrome, if I were to just go to the website address directly....

I just want to, when clicking on a thumbnail, show that in a full screen mode that has zoom/pan.  

I started to try and just make a popup on the current page, but for some reason even setting z-index=1000 and all other zindex unset (except a invisible mouse-catcher at 45) is unset... if I set the app container div (all content in this div) as -3, then I can set the zindex of the image as 3 and it shows above, and gets clicks, but then I can't click on anythin in the div, and the element inspector seems to think the 'body' element is above the app, but setting zindex=-10 on body doesn't move it backwards...

J Decker

unread,
Dec 23, 2018, 3:40:01 PM12/23/18
to Chromium-discuss
has a linked manifest that allows installing to desktop/launcher (as TestPopup 1.0)

opening the window fails in android, works in windows normal and incognito...
Tried to demnostrate two ways to open a popup window, but there's apparently only allowed one window.open per user-input :)  

The example has no issue putting the image also in a div/image on the original page.... still working to narrow down why it doesn't show topmost in the app...
 

--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
You received this message because you are subscribed to the Google Groups "Chromium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discu...@chromium.org.

J Decker

unread,
Jan 19, 2019, 2:05:34 PM1/19/19
to Chromium-discuss
Okay; so I managed to implement somethiing like...

popup = document.createElement( "iframe" );
popup.style.width = "100vw";
popup.style.height = "100vh";
popup.src = text; /* DataURL... data:image/ etc. */

which is almost okay; I think the zoom context of the full sceen iframe is still the parent page's zoon.
Also, I can't seem to add a on(click, close() ) /* popup.remove( ) */


VM2580:1 Uncaught DOMException: Blocked a frame with origin "http://localhost:8080" from accessing a cross-origin frame.
    at eval (eval at popup.addEventListener (http://localhost:8080/app.js:1695:7), <anonymous>:1:21)
    at HTMLIFrameElement.popup.addEventListener (http://localhost:8080/app.js:1695:7)

How is an element created by a script from that domain not also within that domain?

Reply all
Reply to author
Forward
0 new messages