Website fails to load, but on refresh loads? - html

So my domain is pointed at a redirect file which in turn loads the first page in a website.
It has worked in the past. The host recently switched servers though and said it would be seamless. Now when you navigate to www.AiySlumlords.com it hits the redirect then fails to load the second page. HOWEVER, if you hit refresh after it fails then it loads?
I have no clue why this isn't working. Here is the redirect file
<html>
<head>
<title>A web page that points a browser to a different page after 2 seconds</title>
<meta http-equiv="refresh" content="0; URL=./Home/f1.html">
<meta name="keywords" content="automatic redirection">
</head>
<body>
<p>If your browser doesn't automatically go there within a few seconds, you may want to go to the destination manually.</p>
</body>
</html>

Since your server is powered by IIS and ASP.NET, it's better to use ASP.NET to redirect your client, e.g. create an index.aspx page with the following content:
<%
Response.Redirect("~/Home/f1.html", false);
Response.StatusCode = (int)System.Net.HttpStatusCode.MovedPermanently;
Response.End();
%>

Related

HTML mobile redirection - avoid opening in the app

I have a website redirecting traffic to Kayak.com, lately I noticed users that have the Kayak app installed (iOS / Android) on their device, are being redirected to the app, instead of remaining in the browser.
Sometimes the users would get a question "Open in the kayak app?", while for others it will immediately open the Kayak app.
I wanted to ask how to disable this behavior?
I want all users to remain within the browser, just open the URL in the browser without opening the app (similar behavior to Desktop).
The HTML redirection code:
<!DOCTYPE html>
<html>
<head>
<h1> HTML redirection - how to avoid opening on the app / offering "open in the app?" </h1>
</head>
<body>
<meta http-equiv="Refresh" content="1;url=https://www.kayak.com" />
</body>
</html>
I don't have control of app installations or Kayak's website behavior.
I have tried replacing the HTML redirection with PHP redirection,
And tried JS redirection as well.
Both approaches result in the same outcome (opens in the app / offers to open the app).
For convenient testings I added this code to a web page :
http://www.hotels-bargains.com/htmlredirection.php
Any idea on how to keep the users inside the browser?

How to 301 redirect a static url to another static url?

My website is HTML/CSS/JS website with no server (static website) sitting on MS Azure.
I have recently changed 2 of the html files like this:
www.mydomain.com/oldfile1.html
www.mydomain.com/oldfile2.html
To
www.mydomain.com/newfile1.html
www.mydomain.com/newfile2.html
how can I redirect the old url for the sake of SEO, considering the webiste is static and .htaccess doesn't work and it seems the using meta tag in html file is not considered as 301 permanent redirection?!
A 301 Redirect is a server side directive.
Anything you place in a client side file (<meta> / javascript) cannot be read by the browser until the files arrive in the browser.
At this point it's too late to execute a server side directive.
You're now pointing the browser at the destination you're trying to point it away from.
Probably not the best answer, but you could change the the html of oldfiles to redirect to the newfiles.
So something like this:
<html>
<head>
<!--Tells search engines to not index this page-->
<meta name="robots" content="noindex">
<!--Redirect to new resource-->
<meta http-equiv="Refresh" content="0; url=www.mydomain.com/newfile1.html">
</head>
<body>
<!--In case both JavaScript and the meta tag fail-->
<p>If you aren't automatically redirected please followthis link.</p>
<script>
//JavaScript fallback if browser does not support/allow http-equiv="Refresh"
window.location = 'www.mydomain.com/newfile1.html'
</script>
</body>
</html>

Multiple Redirects on one HTML

I would like to create a page which redirects to several pages when it is pressed.
I have written the following code in order to try and do it:
<html>
<head>
<meta http-equiv="refresh" content="0; url=http://www.example.com/a" />
<meta http-equiv="refresh" content="0; url=http://www.example.com/b" />
<meta http-equiv="refresh" content="0; url=http://www.example.com/c" />
</head>
</html>
On the web server log, I see that a request was only sent to "c".
Why is that?
And how can I create an HTML page with multiple redirects?
You will inevitably need to use javascript.
<script>
function redirect(){
windows.open("http://www.example.com/a")
windwos.open("http://www.example.com/b")
windwos.open("http://www.example.com/c")
}
</script>
<body onload="redirect()">
Didn't test but should suffice
I am not sure you understand, when refresh means. Refreshing with 0 means the browser is immediately redirected to the address provided. As far as one browser tab can only show one web page, your example cannot work.
You need to consider using Popups or alike to show the user several pages at one time.

Loading whole web-page

I try to load a concrete web page with iframe:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<iframe id="frame" src="http://www.euronics.ee/" frameBorder="0" width="1000px" height="700px"></iframe>
</body>
</html>
Why it cannot load whole page. It loads only body? It loads another pages well if i try.
If you check that sites code, you will see:
<script type="text/javascript">
//This block of javascript checks if the current page is opened in a popup IFrame
//and if this is true - closes popup and reloads parent window.
//We use Popup template for popup windows and only this template is accepted for popups. A window with any other template will be closed immidiately.
//This also solves the problem with redirecting to parent after user has logged in via Login popup. After loggin in user is redirected back to My Account page
//which in turn uses Audio template thus immidiately gets closed and parent gets reloaded.
if (self != top) {
$("body").empty(); //also clears body to avoid showing page content while the page is closing
parent.location.reload();
}
</script>
And that's why it won't load the site in your iframe I guess.
Not everyone likes the idea of their site to be shown on other sites in iframes. I would say that they just want real visitors.
When I try it in jsfiddle, I get the following console error:
Blocked a frame with origin "http://www.euronics.ee" from accessing a frame with origin "http://fiddle.jshell.net". Protocols, domains, and ports must match.
Could it be that the site you're loading has https requests?

What HTTP status code should I use when serving a temporary page to the browser?

When the client submit something to the server, server confirms but cannot return the result immediately, and serve a page like
<html>
<head>
<meta http-equiv='refresh' content='5; url=/somewhere/else' />
</head>
<body>
Your message is accepted, and the page will back to the home after 5 seconds.
But the browser will put that temporary page in the history. My question is what HTTP status code may I use in this situation to tell the browser not record the URL?
Status code should be 200. If you do not want browser to cache, you should set Cache related meta fields.