Is it possible for me to put a default url for the web app icon on iPhone? - html

I am creating a web app and when I save it to the screen, it only saves to the url I am on. Is it possible to alter the HTML so that if its being saved to the homescreen, it goes to a specific url?

No, it's not possible to change the URL that is linked to the web app bookmark.
A workaround could be to redirect the user to the desired page. You can for example store client information on the server (cookies/session) or device (localStorage). So when the user visits your site you can redirect to the homepage if the client device has no session or if some localStorage value is not set.

Related

How to get the URL to fully reload each time?

Issue: appears to be that banno framework is "remembering" the urls. This is happening in a mobile browser when the user does not close the tab or browser. When the user opens the page, banno is remembering the url from last time and trying to load the same url.
What needs to happen is that banno needs to fully reload the page so that we can go retrieve a new url and log the user in again.
Could it be how they treat plugins when a browser is left open. A url that is loaded is not good forever.
Odds are good that the situation you're encountering is described in https://stackoverflow.com/a/71267143/6680761
Essential info from that link is:
Part of keeping state of the page is keeping authentication data. The OAuth flow used to initially authenticate the user is not intended to be used on every page refresh. It's expected that the embedded web application will keep its own authentication state. How this is done is usually very specific to the language and platform used for the embedded web application. However all strategies almost exclusively use a cookie which is destroyed when the application closes.
The Oauth callback URL with an authentication code should be redirected away from once the code is exchanged for an access token. From that point forward your app should be using its own authentication mechanism.

Save URL of redirected page

I have "hotspot". Then i connect it - it redirects me to login page.
If i have few opened tabs and click on it during auth - they are redirected to my hotspot application.
How to save url except as a GET param?
Application is complex so hard to track all urls changes and pass old url. And it is not pretty.
Something like window/tab storage.
Maybe is there window indentifier that i can save in local-storage or web-sql?
Window identificator can be saved in window.name. It saved across refreshes and urls changes.

Firebase Unauthorized access

Consider the following web application flow.
user hits login/sign up page
user signs up and logs in
browser redirects to their profile page
My question is, using firebase authentication services, how do I restrict usage of the profile page without authorization to the web application?
Moreover, can I host this web application on firebase, and this functionality will be taken care of for me?
Well profile pages for example are generally sites that are dynamically filled with data. You don't have to restrict access to the page itself but instead restrict the API with the JSON restrictions settings firebase offers. This way nobody can access any other profile pages than their own. To prevent annoying users which have for example saved a link to their profile page but are not logged in you can add a redirect users that are not logged in.
Yes, you can create a new project using firebase console and deploy your application to it. You can also enable email authentication to the application on firebase. Follow this link for more information: https://firebase.google.com/docs/web/setup

Redirecting domain name to open an HTML page

I have a script that is being hosted on my Raspberry Pi over my local network.
I'm curious how I would go about being able to type in inventory in my web browser on my PC to be able to open up the HTML page that is generated by the script on my Raspberry Pi?
To elaborate, how would I have my browser to know at //pi/users/home/script/some.html when I type in inventory in the address bar? (Do I set this in my router or in a config file on my PC)
I think what you are looking for is the 'keyword' entry in a bookmark's properties.
You first create a bookmark of the webpage you want to link to. Then open the properties for that specific bookmark and enter the keyword of 'inventory'.
This way, every time you type in 'inventory' in your browser address bar, you will go to that page.

Auth redirect - opening a local HTML document in a new tab in a Firefox extension

I am currently trying to port a Chrome extension to Firefox.
The Chrome extension has a "Login" page, which is opened in a new tab as an HTML document. The HTML document is stored in the local directory with other extension files. The user inputs a URL which should represent a server running our application, where the user will be asked to login. After a successful login, the user is redirected back to the options.html page, which is updated to show the user's preferences.
I would like to duplicate this in the Firefox extension, i.e. I would love to avoid writing anything in XUL to build an options page.
I tried opening a new tab with my HTML page like this:
var url = "chrome://myextension/content/options.html";
var win = Components.classes['#mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow('navigator:browser');
win.gBrowser.selectedTab = win.gBrowser.addTab(url);
But I don't like this for a few reasons: 1) The navbar in the new tab displays the "chrome:// ..." URL, and 2) it breaks the authentication process. The authentication is done using an OAuth type system, and the current URL is passed into the API so that the user can be redirected back upon successful authentication. The authentication fails with "chrome://" as part of the URL.
Just out of curiosity, I tried hardcoding the URL like this:
http://myextension/content/options.html
And the user is actually successfully authenticated, but then the redirect obviously fails afterward.
The Chrome extension seems to work with no problems or weird hacks. From what I can tell, opening it works like this:
chrome.tabs.create({"url":chrome.extension.getURL("options.html"), "selected":true});
And referencing the URL of the tab later so we can be redirected back to it just works like this:
var options_url = chrome.extension.getURL('options.html');
So, I'm wondering: what is the best way to open a local HTML document in a new tab with a Firefox extension, without using the "chrome://" "protocol"? Is there a similar way to how it can be done with Google Chrome extensions?
UPDATE 23/5/12
So this article says that chrome:// URLs are not accessible from the web, only locally.
http://adblockplus.org/blog/web-pages-accessing-chrome-is-forbidden
I think this could be the reason why my authentication was failing. I'm definitely looking for a way for my extension to display a local HTML file in a window or tab without using chrome://.
UPDATE 07/6/12
Here is my (hopefully temporary) solution:
The user enters the URL of the server running our application. He/she is redirected to the application login page, but instead of passing "chrome://myextension/content/options.html" as the URL to be redirected back to after authentication, I pass a phony URL, i.e. "http://myextension/thisis/madeup.html".
In my extension's overlay.js, I set up an HTTP request listener which listens for the phony URL being requested. When a GET happens for the phony URL, I cancel the request, and open the real, locally stored page at "chrome://myextension/content/options.html".
See the following references:
https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIObserver
https://developer.mozilla.org/en/XUL_School/Intercepting_Page_Loads#HTTP_Observers
If you're trying to do this redirect for an OAuth call you should try using OAuthorizer from Mozilla instead of doing the redirect work yourself. Hope that helps!