Open link using system browser using InAppBrowser - ionic2

I am using Ionic 2 and want to open a PDF file from a remote server using the device's default browser. I have a couple of problems:
First, I am unable to run this on the browser. I get this error:
Native: InAppBrowser is not installed or you are running on a browser. Falling back to window.open.
The ionic docs seem to indicate support for all devices and browsers. Am I doing something wrong or the docs are wrong?
Secondly, when I run the app, the PDF file does not open in the system's default browser but within the app. I am using Ionic View to do the testing. Here is my code:
import { InAppBrowser } from '#ionic-native/in-app-browser';
constructor(public appGlobal: AppGlobal, private iab: InAppBrowser) {
const browser = this.iab.create('www.google.com', '_system');
browser.show();
Also, if I change the URL to my php script that generates and returns a PDF file, it does not work at all.

To use the device's default browser, you don't need to use the IAB. You just need to open a new window with _system. Your device will do the rest.
window.open(url, '_system');

You can also do what you're doing if you want to keep the IPB, just omit the open function.
Adding the _system target means you don't need to do this anymore as it crashes the app.

uninstall inappbrowser plugin and simply try this:
window.open(pdf_url, '_system', 'location=yes');

When you use _system browser, it's not necessary use browser.show()
this.iab.create('www.google.com, '_system');

Related

Is there a way to use the python model "webbrowser" with Heroku?

I am working on deploying a django app to heroku and I am having trouble with the webbrowser module. The function initially creates a pdf from html using pdfkit (this part works fine). Afterwards, I use '''webbrowser.open_new_tab''' to render the pdf in a new tab. This works perfectly locally, but not when I deploy to Heroku :( I checked the Heroku log, and it indicates that the pdf is being properly compiled and that the webbrowser command is successfully called, but alas, a new tab is not opened... Are there any suggestions on how best to tackle this issue? Perhaps I am missing an important environment variable that allows me to open new pages on the user's browser?
Thank you,
-- Carter

Ionic 2 - Open external pdf inside my app

I have some pdf file links on my app, and I wanna the user be able to open/read then inside my app. Is it possible? Is there any easy way to do that? Thanks!
EDIT:
Until now, I'm using regular link, like this:
<a href="{{conta.link_conta}}" *ngIf="conta.link_conta">
But in that case, it opens on the external browser (chrome for android, in my test). I would like to open it inside my own app, kinda like facebook, instagram, twitter and some other apps do
Didn't try it, but can't you use InAppBrowser plugin
https://github.com/apache/cordova-plugin-inappbrowser
Set the target as '_self',

Ember 2.0 not live reloading

I created a new app using the ember-cli. It creates the project just fine. I updated the 'bower.json' file to use 2.0.0 for both Ember and Ember Data and installed them. The core of my application setup works how it should.
When I do 'ember serve', my application opens at localhost:4200 but is constantly showing the reload gif on the tab and the status bar at the bottom of the screen continues to show 'waiting for localhost...'. The 'Welcome To Ember' text shows. Any changes I make are not live reloaded in my browser, however, a hard reload shows the changes even when just trying to edit the application.hbs file. Any ideas as to what's going on?
Are you on windows? It sounds like this bug that is currently being worked on.
https://github.com/ember-cli/ember-cli/issues/5123
For me ember serve --lrp 9000 worked and fixed live-reload.
(I tried the other suggestion to use ember serve host 0.0.0.0 and it stopped the "loading" spinner, but live-reload still did not work.)

Use of window.location.href in crosswalk

I use crosswalk 5.34.104.5 to build Android app.
After executing
location.href = '/another_page.html'
in index.html, which is a entry point defined by manifest.json,
empty alert pops up and blank page appears.
another_page.html is located in the same directory as index.html
(i.e. it is in apk file whose path is assets/www/another_page.html relative to apk's root)
and is not served over network.
How can I achieve intended location transition?
It is a typo in "asserts/www/another_page.html", it should be assets, right? I can do the same thing with changing location.href to load another page.
EDIT: If you are using make_apk.py to package your app, you can pass "--enable-remote-debugging" to turn on remote debugging for your app. Once the app is launched on your device, open 'chrome://inspect' in Chrome browser running on the host machine, and inspect the page to directly execute "window.location.href=xxx" in console, and try to fix your problem. See https://crosswalk-project.org/#wiki/Remote-Debugging-on-Android for details.

Qooxdoo reuse cookies between sessions?

Recently I have create some UI tests for a qooxdoo application with the built-in simulator ( I am using qooxdoo 3.0.1, selenium-server-standalone-2.35.0 and firefox23)
and I need to store a cookie in the browser and save that for the next time that it open.
code that stores the cookie:
if(!this.getQxSelenium().isCookiePresent(debugVariable))
this.getQxSelenium().createCookie("debugVariable=0","path=/, max_age=350000, domain=subdomain.foo.com");
console.log(this.getQxSelenium().getCookieByName("debugVariable"));
I have find that there is an argument in the server the -profilesLocation that specifies the directory that holds the Firefox profiles that java clients can use to start up the Firefox
I even try to use -browserSessionReuse but it does not working either for me.
I see this is not enough what other solution I could try to make the Firefox to remember the cookies?
This is not a qooxdoo-specific issue. I tried it with a plain HTML+JS page and Selenium's -firefoxProfileTemplate option and it didn't keep the cookie either.
You could try using an older version of Selenium (and perhaps also Firefox). -firefoxProfileTemplate is specific to Selenium RC, which is deprecated and gets more broken with every new release.