Inject Javascript into Chrome with Android App? - android

Is there a way for an Android app to inject Javascript into a web page that's opened by Chrome?
The app would need to essentially run in the background 24/7 and startup with the phone as well.
We have a browser extension for Chrome that does similar. Basically it's just a content script that's added into every web page browsed by the user.
I couldn't find if there's a way to do that with an Android app or if it's impossible to modify web pages opened in Chrome.

Related

Is it possible to emulate Kotlin android Android with a browser?

I am looking forward to create an Android app with Kotlin.
But I can not use Android Studio or other IDEs. I am using the Amazon AWS Cloud9 IDE now.
I have found there is WebView and read articles, but I still cannot figure out how it works.
It is possible to emulate the UI on the web or is it only for web application development?
The WebView framework allows you to specify viewport and style properties that make your web pages appear at the proper size and scale on all screen configurations for all major web browsers. You can even define an interface between your Android app and your web pages that allows JavaScript in the web pages to call upon APIs in your app—providing Android APIs to your web-based application.
Consider using these alternatives to WebView if your app falls into the following use cases:
If you want to send users to a mobile site, build a progressive web app (PWA).
If you want to display third-party web content, send an intent to installed web browsers.
If you want to avoid leaving your
app to open the browser, or if you want to customize the browser's
UI, use Chrome Custom Tabs.
More details

How android application and web application working?

I'm a little confused because I couldn't understand how android application working at the same time with web application . for example I have a web site and I wanna have a android app for my website and how can i programming at the same time , can i build my android app with php ?? this is the main question i have and i don't understand what i should do and how web site and android app working . for example Amazon has a android and ios app at the same and Amazon has a website , how those thing working together ???
You can build a webview app that is app where you can display HTML with Css and maybe also JS.
That is what google said about webview app:
By default, a WebView provides no browser-like widgets, does not enable JavaScript and web page errors are ignored. If your goal is only to display some HTML as a part of your UI, this is probably fine; the user won't need to interact with the web page beyond reading it, and the web page won't need to interact with the user. If you actually want a full-blown web browser, then you probably want to invoke the Browser application with a URL Intent rather than show it with a WebView.
You can find more information about a webview app is here: https://developer.android.com/reference/android/webkit/WebView.html
If you have any other questions about it feel free to ask.

Mobile App is not able to show a PDF that is stored on Web Server

My team works on a Mobile application, as well as a web application. The mobile apps are about 80% web views that live on the web server.
We have a Help page that now requires a link to a PDF File that also lives on the Web server.
When I attempt to make the controller return File("pdflink.pdf","application/pdf") everything works fine on the iOS application. When I try to use one of our Androids to hit the same link, the Android just shows a blank page and the PDF does not open.
I was wondering if anyone has ever had to create a mobile view on a web platform that was then called by mobile applications.
I have tried creating a view that used an iframe with the pdf in it, but that also did not work on either device (iOS/Android).
Any help with how to handle a web link to a pdf from mobile applications?

Responsive Web App with phonegap

We have a responsive web application for desktop users and it is working fine. My organization also has native android app. Now, the requirement is to integrate responsive web app with native android app (using webview). Same time, we are looking to access some native features of device like capture photo from web application.
We suggested to use phonegap but don't know how we can integrate phonegap javascript api with existing web application without creating phonegap/corodova application. Idea is that, user just hit the native app button and on listener it will invoke webview with webapp url. By checking user agent we will be able to load phonegap JS api and it will be able to access native features.
Issue is that, Don't know whether it is possible or not, if yes then how we can enable phonegap api in existing web app. Desktop and mobile user will get same experience.
Use WebView component of phonegap in your application, read documentation
http://docs.phonegap.com/en/3.5.0/guide_platforms_android_webview.md.html#Android%20WebViews

Force links on external site to open up outside of UIWebView on iOS or Android app

Is there a way to prevent my site from being opened inside a UIWebView of any iOS or Android app, such as formatting the URL in a special way? These are apps that I do not own, so the call is coming from my page, not from the app.
Preferably, when an app tries to open the page on my site from within the UIWebView, it would automatically open up the page in the Safari or native browser app instead of inside the users application.
Otherwise, it looks like I would have to run some javascript to determine if the page is opened inside of a UIWebView and then just restrict access.
No. A browser is just an app. There is no specific distinction between a browser app using a webview and another app. That link for javascript browser detection will be pretty much useless for this scenario. Apps can set their user agents to whatever they want, including a user agent identical to what the native browser app uses. Essentially anything that you try to use to detect the default browser can be mimicked by another app.
You could change the user agent in your own app to something specific that you could then detect with javascript.
You can also call javascript functions in the webview from your iOS code so you could potentially wait to display things until that call comes from your app.
While these things can be easily mimicked, and wouldnt block a scraper that ignores javascript, it's unlikely someone will go through all the trouble. If you want further protection, you'll have to introduce some form of authentication.

Categories

Resources