How can I change environment for the tablet device? - javascript

I have a webservice app, and this is connected to an android device to create "inspections". Once you have created it, there are options to "synchronize", which allows you to upload this inspections to the webservice through a REST service. The problem is that I have a different environment and I want the android device to work on my local environment (development) and not in previous environment as actually.
I have the device connected with localhost using "chrome://inspect/#devices" tool. Also, I have changed the "baseUrl" in app-config file. Now, the main problem is that I can't login on the device app, but the localhost on browser works.
Any suggestion? Thanks.

Related

Android: how to run a local server in webview? ( = emulate a server in webview)

I have a server that runs a website (with html, CSS, javascript) accessible from any browser.
Now, I want to run the code of this server locally in a webview of my Android app. For that, I placed all the code of my server in the 'assets' folder of my app.
Now, how should I proceed in order to emulate a server in the webview of my Android app?
Thanks for your help.
You can deploy your website with WampServer, XAMPP then connect your android phone with same network. After that, you can see your website on your Android phone.

Communicating with PHP from an android app without internet?

I have made a web page and i am running it on a local host using the xampp server. In this web page I have a canvas that draws a line between two point. I read these points from a locally available csv file that I have generated. I would like to make an android application, where there is a provision to enter two numbers. I want this android application to make a csv file and save it on my computer so that I can access this file using my javascript.
Note: can I pass these values via an usb connected between the mobile and computer so that I can make a csv file locally in my computer? I want all of this to happen without the requirement of internet connection.
PS: I am newbie to android. If the above is possible, then please brief on how to approach this problem.
If you have a XAMP server all you need to do is connect the android device to the same network/router. There you can talk via HTTP methods to the apache server. You will just need to provide the ip address to the android app.
In the router you can set a static ip address for the mac address of your computer, so every time it connects to the router it always get the same IP and you dont need to input it again on the android app.

Get userID of current windows user in my website via JavaScript

I have a feature in my upcoming web project where I will have to get the UserID/Email ID of the user currently logged in to the machine/PC. Target OS is Windows 10 and logins to the machines are done via Smart Card only. User Data is stored inside MS-AD.
This UserID will be used passed further for Authorization and load the app in browser. The target browser is IE and Chrome.
Is there a way i can fetch the EmailID/UserID of the User logged in via Smart Card to system in Javascript?
ADDITIONAL INFO: The website is setup in private environment. There is no public URL to access the webapp from outside Intranet. The client and backend code is hosted inside VM in Cloud. In nutshell, the is all sitting in private environment in Azure.
Thanks!
Not with JavaScript. JavaScript is run inside the browser container, and more specifically run inside your current webview. Letting JavaScript get access to settings and data on the local machine be a nightmare if phishing, malware and virus sites.
If you know which computers will run your website you could create an application with a server that's running idle on the machine, much like how Spotify's client is doing (the windows client can take commands from the webpage).
The application/server could then try to get the EmailID/UserID from the computer, and then having the server running on some specific port, your JavaScript could then use AJAX-requests to communicate with the local machine from the browser.
I could get the Windows Logged in user using the ActiveX script in IE.
var WinNetwork = new ActiveXObject("WScript.Network");
alert(WinNetwork.UserName)
Will this be a good approach to solve this issue?

Running angularJS in an Captive Network Assistant (WISPr) on iOS and OSX

From previous projects I know that Apple's Captive Network Assistant (aka WISPr client, too) runs a restricted browser, see How can I debug the browser in Captive Portal? and Ajax on Captive Network Assistant on iOS and OSX.
My hotspot is running a angularJS web page. On a Windows Phone 8.1 and an OS X Lion my angular page works fine. On my iOS 8.3 there must be a JavaScript error somewhere in the code, because I can see the angular variable expressions {{myVar}} in the code which means the angular framework isn't loaded properly.
Any idea what could be the cause?
Solved
Cause has been found, not by me but a friend of mine. Turns out that the CNA browser (WISPr client) doesn't allow the use of the browser's local storage. Whenever you try to write some data into the local storage, the application crashes.
Thus, the solution is either to switch from local storage to normal cookies or to do a user agent detection in JavaScript and exclude CNA browser (WISPr clients) from the use of the local storage.
Many thanks #chedabob, the idea of checking if JS is enabled led to the local storage check. Really appreciate your support.
You could possibly use WeinRe to remotely debug it, however if the root of your problem is the Captive Portal view isn't running Javascript, this probably isn't going to help
https://people.apache.org/~pmuellr/weinre-docs/latest/

How to open an HTML project on the iPad

I have an HTML project (CSS/JS/jQuery) that I'd like to test on an iPad (in Safari). From what I've read, iOS browsers don't support the file:///path/to/project protocol, and even if it did, I don't believe that you'd be able to navigate the file system to where your project is located.
Please correct me on any of this information if I'm wrong, I'm an Android guy so much of this is new to me. Nonetheless, I tried to use an app called Fileapp to solve my problem. I was able to access and load my project, but it was within Fileapp's native browser, and not Safari (unless it actually WAS Safari and it was just masked).
Does anybody know of a solution to my problem (preferably free)?
2016 UPDATE:
There are several services which now make this easy. If you don't have your own web server check out one of these free services which make updating a live webpage from your PC easy:
Heroku
Git Pages
Both of these services require using git, learn it, you won't regret it.
Days of FTPing or using Dropbox to serve html to an iPad are long gone.
If you need to be able to do this while not connected to the internet check out this article on using local IP tunneling. This would essentially open up the localhost on your PC to be viewed by anyone on a wifi network, regardless of if the wifi was actually connected to the Internet.
http://wesbos.com/localhost-mobile-device-testing/
I prefer Heroku as I am more likely to be switching between locations and PC's than I am to be on a wifi network without an Internet connection.
OLD ANSWER 2012
Get a Dropbox account and put the project in your public folder.
Right click to get the public link and then browse to that location on your iPad.
When I get link from the iPad app it doesn't work it just shows the raw html with a URL structure like so
dropbox.com/s/...
When I go to the website and copy public link (only available if the file is in PUBLIC FOLDER) I get the link that actually works.
Apache probably isn't the most convenient webserver to use for this kind of ad-hoc serving of a local project. Instead, if you're on Mac or on a Linux distribution that has Python installed (which is most of them), you can launch a webserver to serve your current working directory at the terminal with a one-liner:
python -m SimpleHTTPServer
By default it will serve on port 8000; you can specify another port by passing it as a final argument to the command.
To connect to this server from another device, like your iPad or phone, first of all you'll need to make sure your phone is connected to the same local network as your Mac or Linux PC. Then, on the computer, run
ifconfig
and look through the output for your local IP address, which will be labelled as inet addr in the output and listed under one of the connections other than "Local Loopback". On my current PC, I see inet addr:192.168.0.3 listed under the wlan0 connection.
Now, on your phone, open your browser of choice and navigate to the IP address you got from ifconfig on whatever port SimpleHTTPServer is serving on. For example, http://192.168.0.3:8000. You'll be presented with a directory listing corresponding to the directory in which you launched the server, and from there you can view whatever files you're interested in.
The answer to your question is that even with iPadOS the iPad is not a replacement for a Windows, Linux, or Mac. Still too many “can’t get there from here” cases.
One solution to the problem, as pointed out by minitech in the comments of the original questions, was to set up an apache server on my local network and connect directly to it. This worked exactly as I needed it to.

Categories

Resources