NSURLConnection and Javascript - javascript

I'm trying to log in into a web page through an iPhone app. I'm using a NSURLConnection to try to connect. The app seems to be logging in correctly but I'm then getting redirected to a page that says I can't continue without Javascript enabled. I'm running all of this through the iPhone simulator that comes packaged with xcode. The curious part is that when I navigate to the same web page with the same information in safari in the iPhone simulator I don't get this reconnect, it sends me to the page I want.
Why is using the NSURLConnection giving me this redirect if I have Javascript enabled in the simulator and can navigate to it outside of the app? Thank you for any help.

NSURLConnection does not interpret javascript. Safari does interpret javascript. If you need it to interpret javascript use UIWebView and actually display the webpage.
Your webpage should implement "graceful degradation". Which just means your site should work without any javascript. You can find plenty of documentation about graceful degradation if you google.

Related

Javascript Not Working on Android Default Browser

I am working on a web site that is served via a Mikrotik Router.
It's a site to provision internet for users up to 100m away.
When you connect to our Wifi, a sign in page is supposed to pop up where you enter your credentials to authenticate and use our internet.
For some weird reasons whenever the user tries to sign in, for android users the Android OS keeps on presenting their default browser to sign in on the Network. Unfortunately, it appears that the Javascript is not running on the native default Browser that popped.
I am not using any ES6+ features so I'm currently lost at what could be wrong.
When I previewed the Site on Google Chrome/Opera Mini and Phoenix Browser, the javascript is working very well.
I added this tag before the closing tag of my head element:
<noscript>
<div>
We're sorry but our site <strong>requires</strong> JavaScript to work.We recommend you use Google Chrome.
</div>
</noscript>
to be displayed if Javascript is disabled, but it is not even displaying.
I tried inspecting with Google Chrome devices inspection but it seems Google Chrome devices inspection only works with Google Chrome Mobile Browser(I might be wrong).
Any insight to fix this would be really appreciated.
Thank you.
I think you need to set setDomStorageEnabled(true)
for the webview settings.
You can read more about webview here:
http://tutorials.jenkov.com/android/android-web-apps-using-android-webview.html

It is possible to force user to open link by safari when user are using chrome in ios [duplicate]

I have a web application which runs on all browsers but there is a link to another application which can only run in Internet Explorer. How I can force browser to open this link in a new IE browser when my application running in other browsers such as chrome? Should this piece of code written in server side or client side?
You can't force the client to launch a different browser like you're asking.
What I would suggest is to have your application test when it is launched to see if it is currently running in IE. If it isn't, it should issue an error message stating something like: "This application requires Internet Explorer. Please reopen in IE." Then have it stop there.
Most probably, using resources of JavaScript and HTML5, you cannot run applications on end user's computer. Moreover, it sounds incorrect in terms of security and usability.
The best thing you can do is to write a message like "Open this link in IE" near your link.
At the final page, you can detect a user's browser and, in case it is not an IE, show him a message "Unfortunately, this web-page works only with IE. Please, open it in IE".
By the way, could you tell us, why your page is not working in other browsers? Probably, we will find a proper answer there.

How do I launch a standalone web app from mobile safari using javascript?

I am developing a standalone web app that installs on iphone homescreen.
It has a calendar function that the user can download an *.ics file directly into the iphone.
However, that cannot be done from within the standalone web app, so I have a punch out url to mobile safari so that it will work.
All that works fine...
However, after the ics file is loaded into the calendar and closed, it returns to the mobile safari page where I in turn close that by using onclick='self.close()'. That works fine too...
After that page closes I want to then launch back into standalone app so the user is returned to where they were...
How do I launch my own web app from a mobile safari javascript code?
All the searching shows me how to go from standalone to mobile safari,...I want mobile safari to standalone.
I have seen the windows.location="myapp://myparam" but cannot find proper syntax to get it to work.
What is the syntax for this?
Any other solution is well received too...will need to find Android solution too, but it is not as crucial...
Thanks

C# MVC Facebook application does not work in iPad Facebook application

I've written a Facebook application using Microsoft's ASP.NET MVC template. Works great from the browser on IE, Android's browser and will even work in Safari.
Inside the Android Facebook application clicking on the link to my application bounces you out to the web browser and everything is good to go. On an iPhone or iPad going to my application works fine from inside Safari. But if you run the iPhone or iPad Facebook application you get an error. Across the top it says 'Error' and the details say "An error occurred. Please try again later."
I've search the SDK docs and googled around but I've not found anything that tells me what to do. Did I miss a setting for my application? Is there some special cookie I need? Do I need to go leave my wallet at Steve Job's grave?
Any help would be appreciated.

How do I detect user's location from a webpage opened in the Android browser?

Visiting www.google.com on the Android browser (or even with an android spoofed user-agent), presents the option to "Share Location". When clicked, it uses the GPS/Cell phone towers to figure out the location. I tried the google.loader.clientLocation but that only works using the IP address.
Is there a method to tap into the Android OS and access GPS data from a regular web application (and not an Android application) similar to the way Google does?
[Perhaps Google uses the Google Gears app on Android to access this data.]
Thanks!
This is an HTML5 API, and it'll work on Webkit-derivatives, Chrome, and Firefox 3.5 (for now).
http://dev.w3.org/geo/api/spec-source.html
http://merged.ca/iphone/html5-geolocation
I was trying that recently and found this forum posting interesting. I did not find a real good way to do this either and it doesn't look like we can do that without writing our own app which opens a browser instance.
http://androidforums.com/support/8868-how-get-gps-coordinates-browser.html
Here is also a nice example: http://klauskjeldsen.dk/w3c-geolocation-api-html5/

Categories

Resources