Force link in uiwebview to open in Safari - with JavaScript - javascript

This has a lot to do with my previous question:
detecting UIWebView with Javascript
I would like to force a link on my webpage to be opened with iPhones actual Safari Browser, and not in a UIWebView window, even if the app it's being viewed in tried to open all links in a UIWebView window to prevent users from going out of it.
Please note that this is not a duplicate as I'm trying to do this with Javascript/Client-side, not within my own native app (I own the page that's being viewed, but can't control which app is used to view it).

I do not think this is possible. I set up one of my apps to use a UIWebView only and never open Sarfari (though admittedly I allowed only pages within a certain domain).

Related

How to open a browser app which is listed in chrome://apps

Chromium-based browser has the apps page at chrome://apps
There are some apps that I have installed into it. Is it able to launch one of them from JavaScript somewhat just like opening file selecting box?
I can open chrome://apps by setting this URL in to a link, but how about a single app?
Copied from: Open Chrome in a new window (Chrome app)
Sadly, there's no way to do that I know of.
Using window.open in an app's context is a bit of a hack, but results in the URL being open in the user's default browser (not necessarily Chrome). There's no control as to how the browser chooses to open it.
There's a Chrome App-specific API that was created specifically with "open a page in Chrome" in mind, chrome.browser. However, it still doesn't provide an option to open in a new window.
The closest you can get is to create your own "browser": an app window with an in it. Then you have full control over the presentation, but it's not integrated with Chrome's profile and may require additional work to implement things like dialogs and browser controls. See the Browser sample app and documentation.
You may need the app id which you can then append to the URL. I am not entirely sure how you would find but if you go to the apps page on chrome, drag the icon of the app to the search bar in the browser, you should get the full link.
For instance, I dragged the Google Slides Icon onto the search bar and it gave me this url chrome-extension://aapocclcgogkmnckokdopfmhonfmgoek/main.html. So, you may give it a shot! Try to open the chrome apps page, then drag the app you want to open in new tab onto the search bar.
Hence, using Javascript:
window.open("chrome-extension://aapocclcgogkmnckokdopfmhonfmgoek/main.html", "_blank");
Opens Google Slides App in a new tab.

Chrome extension hidden / non-displayed tab

Part of my extension involves accessing a webpage and then programatically performing certain functions for the user. The app would obviously be much cleaner if the user did not have to see all this happening in a browser window.
In some situations this could be achieved by, displaying other content (useful to the user) in a browser window, loading the screen with the programmatic elements in an iframe and manipulating them through an action script that triggers on the page load of the page loaded in the iframe.
However, for my purposes this is obstructed partially by the cross-domain limitations and totally by the fact that site in question does not allow iframes.
(One solution was to reverse this process--i.e. direct the browser to the correct page and throw up the useful content in front of it, thereby hiding the noise while loading the page in the browser. This works but it is horrible for obvious reasons)
Is there any clean way to either:
Open a chrome window but keep it hidden?
or
Load a page (i.e. have a DOM built etc) without doing so in a window/tab?
Have you tried using
chrome.windows.create({url:yourUrl, focused:false, state:"minimized"}, function(hiddenWindow){
//do whatever with hidden window
});
or having an <iframe> in the background.html of your extension?

WKWebView detect Angular / React JavaScript page load?

I'm building an application which contains a WKWebView and trying to detect when the user navigates between pages. The WKNavigationDelegate works fine for plain old HTML sites with links, but fancy new Angular/React sites slip right past it. Is there any way to detect this?

Chrome extension: default pop_up vs injecting a div in page

I am getting confused understanding the practices generally followed in the popular chrome extensions. I am trying to develop my own chrome extension and after going through the basic tutorial, I have a default popup page that opens whenever I click the extension icon near my address bar. So far so good! While checking the source codes of some good extensions installed in my chrome browser, I came to know, none of them uses the default_popup page but definitely invokes some javascripts through either the background page or content scripts. But the final behaviour as seen by the user is functionally like a popup at the upper right corner of the screen, though more presentable. Is there any reason for not using default_popup over using other mechanisms?
I think it really depends on what your app needs in terms of functionality and design. As there are no real reasons why you might want to choose one over the other. Most information can be passed from the page to the extension app and vice versa. Users expect a popup when they click on the button but injected popups are also supported and commonly used in Chrome, Firefox and Safari.
Pros/Cons:
If your extension depends on the page content then you can inject scripts that analyze the page and inject divs accordingly. You can send analyzed data back to the extension and open a popup but thats an additional step. If your extension has nothing to do with the specific page then you would be better off using a popup.
Popups close when you switch tabs or your browser loses focus. Injected popups need not.
Don't inject scripts and stylesheets into pages willy nilly. They interfere with a website's native js/css and also stuff injected by other externsions which is near impossible to fully account for.

How to View an iframe in Phonegap without Leaving Page?

In phonegap, I'm trying to iframe to the webapp hosted on a domain. The app needs to be disabled while in motion, so the index.html has the javascript that would freeze the page (IE, create an absolute div that would prevent you from touching anything inside the iframe) if moving faster than a certain speed. However, I can't seem to iframe the way normal browsers do. An iframe immediately opens in a browser window, and even with ChildBrowser installed the iframe is still separate from the parent view, so my javascript to freeze the app would no longer apply.
Is there any way to have an iframe work the way I'm trying to get it to in Phonegap?

Categories