URL in Address Bar not Changing for NodeJS powered website - html

I'm building a website that's entirely hosted on my own VPS using NodeJS since I don't want to pay for hosting and I already had the VPS so I figured why not use it.
The issue I'm having is whenever I click on a link from the homepage and navigate to that page, the website does exactly what it's supposed to do but the url doesn't update in the address bar.
Say my url is www.examplesite.com and when I click a link, it goes to www.examplesite.com/application. The second url isn't reflected in the address bar so when I refresh www.examplesite.com/application, because it says www.examplesite.com in the address bar of Chrome, it reloads the home page.
Is there a way to fix that via node or will I just have to suck it up and buy web hosting? I'll do it eventually but not for a while.

Perhaps you never call res.end(); in your server function?

Related

How to make a PWA landing page different from the site landing page when offline?

My application has historically worked by having a landing page that's shown to everyone. There's a login button and if you click it, it shows a dialog for credentials, and when you enter them successfully, you are logged in and redirected to the home page for your login type.
In a PWA situation, once I know who the user is, I'd like to put an "install this as an app" button on the home page, and then since I know who the user is, there's no need to show the general landing page and ask for a login. I'd like to just remember the user and go right to their home page.
I could cache the login information in local storage, but I want to do this ONLY when offline and I think the PWA would still show the default landing page and, at best, immediately redirect to the home page, and this would look bad.
Is there a way to set this up the way I would like to?
In order to install a PWA you created a manifest file and a service worker. When the application is successfully installed (added to home screen) the service worker comes to action. The service worker will be serving all the files you have declared either online or offline. This means it will be serving the manifest file.
In the manifest file you can add the start url which is going to be the one defined route, in this case go directly to your app instead of the landing page. In your manifest file just add:
"start_url": "../joshuaFrankApp"
or
"start_url": "../joshuaFrankApp.html"
Whenever the app is installed (doesn't matter if it the user is online or offline) it will be redirected to the page you wanted.
Extra information:
https://developer.mozilla.org/en-US/docs/Web/Manifest/start_url

Can redirect website/page when site server is down (This Site Can't Be Reached)?

is there any possibility to redirect the website or a page on my site, in case the server crashes (is down) ? I mean, I get sometimes the error "This Site Can't Be Reached", because of my hosting servers, and somehow I want to redirect to another website only when this error appears.
can be done, somehow?
Not directly. You can't send an instruction to the browser to redirect if it can't make a connection to your site in the first place.
You can put another service, with better uptime, in front of your site (e.g. Amazon CloudFront) and have your visitors request from their services instead of directly from yours. Obviously this doesn't work so well if you have personalised content.
CloudFront or another edge-cache would do this for you. It stores a copy of your website in a cache that sits in-front of your website. When it detects your website is unhealthy (i.e. down), it can display some predefined html that you store in e.g. an S3 bucket. In terms of redirecting to another website, you could put a link in that html, but it wouldn't be an automatic 'failover' where if your site is down, another entire web page loads.

Create a link that can later be customized to different URL

I would like to create a link that I can customize later.
For example,
I create a href link in the footer of the website I developed for my client with the URL that forwards to my current Web design website.
In the future, if I have to change my Web design website URL I will just customize that footer link forward destination to another one without having to access the CPanel of my client's website.
Please tell me how is it possible to do. Is this possible to with any link shortener services?
The usual way to do this is to set up a redirect from your old site to your new, with a 301 status code. This is easily done with a simple configuration directive in your web server config.
I doubt if there is any link generator service that let you change the redirection link after generated.
If you will be able to access your previous url, link it with redirection page that will redirect client into your current url.
Or get a free domain that only works as redirection link.

Login to a website automatically via Chrome Extension?

I am working on an extension for a University website which likes to always make you log in, so one of the features I am trying to implement has to do with logging the user in automatically.
I could at the first load of the webpage automate clicking the login button and filling in the login data, however I want to make it more transparent and login in the background. Having the users username and password is it possible to do a login in the background by calling the same url the site uses and giving the post data? The site uses https, would this cause issues? How would I do this? Any good examples out there of this?

Can I show my domain name in links in a URL frame, or similar setup?

I want something between a URL frame and URL redirect.
I have a domain called http://www.mydomain.com.
I have pages on my site. When I click on "page1.html", I would like the address bar of my browser to show "http://www.mydomain.com/page1.html". I want it to show this because then users can click "back" or "forward" in their browsers.
Right now, my domain name provider (Namecheap) has two choices:
URL Frame: This always shows "http://www.mydomain.com", which messes up "back" and "forward" because the subpages aren't shown.
URL Redirect: This causes the address bar to show "http://www.uglydomain.com/subfolder/subsubfolder/page1.html".
What is the best solution? A silly, slightly incomplete solution would be to hard-code all of my links on my pages to "http://www.mydomain.com/page1.html". Can I achieve what I want through .htaccess, redirect rules, or something else?
In theory, if you had access to the site hosting the frame document, you could implement something with pushState and postMessage, but its highly unlikely that you do.
The only real solution is to get proper DNS hosting and point the DNS for the domain at the server hosting your website, and to have sufficiently good hosting that you can set up a virtual name host for the domain on your web server.