Why is 'noreferrer' not working on links? - html

I can't work out how to get rid of the referrer that keeps getting appended to URL
My link
<a aria-label="Book" target="_blank" class="book-link" rel="noopener"` or `rel="noreferrer" href="<?=$site->book_link()->html()?>">...</a>
My meta
<meta name="referrer" content="no-referrer">
It keeps appending this and breaking links /&referrerUrl=https%3A%2F%2Fwww.mysite.com%2F

This referrer that you are getting is not effected by this meta tag because the meta tag is meant for inside javascript to use document.referrer to get the referrer url in your browser or from your webserver for tracking purposes.
The referrer in your link is either because of some script or front end framework you are using or because of a backend framework or language like php.
To be able to solve your problem better we will need to know more about your frontend and backend stack.
Consequently this question is tagged wrong. It should be tagged with javascript or php.

It's simple "no-referrer", which specifies that no referrer information is to be sent along with requests made from a particular request client to any origin. The header will be omitted entirely.
If a document at https://techcaregn.com/page.html sets a policy of "no-referrer", then navigations to https://techcaregen.com/ (or any other URL) would send no Referer header.
It is my personal opinion .

Related

How would I make a meta redirect that redirects to the URL stored in the parameter?

I am attempting to setup a service which will redirect the user to a URL stored in the ?url= parameter, how would I do this?
I have tried using meta
http-equiv="refresh"
with
out.print(request.getParameter("ur;")) %>
however all that happens is the page reloads in a loop. Not too sure if I need to use quotation marks (e.g /?url="https://google.com")
<meta http-equiv="refresh"
content="0; URL="<%
out.print(request.getParameter("redirect")) %>">
What I need to happen is when the user gets redirected to "https://example.com/exampledir/index.html?url=https://anotherwebsite.com" (just an example url) the script on index.html will get the parameter and redirect to it exactly. What actually happens is the page just reloads in a loop.
Since you're not using any server-side language, you won't be able to generate a different meta tag during rendering. Instead, you'll need to do this with JavaScript after the page loads.
Add a script tag to the bottom of the page like this:
<script>
var redirect = new URL(window.location).searchParams.get('redirect');
if (redirect) window.location = redirect;
</script>
Now if you browse to the page like this: http://<myserver>/myfile.html?redirect=https://google.com you'll be redirected to https://google.com.
For reference, see MDN articles on:
Window.location
URL.searchParams
I also highly recommend you read through Java​Script basics just to make sure you understand the overall concepts presented here.

Need to add the requested URL on a "404"-page. [HTML]

If the user tries to access a page which isn't available, he/she is moved to a custom 404.html.
What I'm wondering is if is it possible to access the original requested URL from the custom 404.html, using just HTML? I haven't used PhP or any other side technology.
My code look like this:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<p>Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.</p>
</body></html>
If anyone know how do this, please let me know. Thank you in advance!
Long story short, answer to your question: no, it is not possible to get url by using HTML ONLY, you need to either use client side or server side language.
for example, in javascript, you would do something like this to get previous url,
document.referrer
this would actually be ideal for your scenario, as this work very well, if you arrived at the current page via a link ( not by doing, for example, by bookmark or typing in the address bar).

Schemeless URL valid in HTTP?

Are schemeless urls like
//blog.flowl.info/
valid in HTTP (rfc?), like in plain HTTP Requests and Responses, or are they only valid in HTML attributes and content ?
HTTP/1.1 302 - Moved
Location: //blog.flowl.info
GET //blog.flowl.info
Update:
I have two contradictionary answers now. Which is correct?
Sidequestion:
Why does the browser even resolve those to:
//blog.flowl.info/
->
http://blog.flowl.info/
instead of:
//blog.flowl.info/
->
http://blog.flowl.info///blog.flowl.info/
They are valid in the Location header field (http://greenbytes.de/tech/webdav/rfc7231.html#header.location).
They are not valid in the request line of an HTTP request.
The browser resolves it this way because this is how relative reference resolution works (http://greenbytes.de/tech/webdav/rfc3986.html#reference-resolution).
As far as I understand protocol/scheme is a mandatory part of an URL and is used by server and intermediate proxies/gateways etc to infer how to handle communication on top of plain TCP/IP. If you are not using http/https but some other well known or even custom protocol, you will have to specify it.
Browser was created for browsing html pages served over HTTP protocol. Hence if you don't specify scheme it automatically defaults it as http. There is also concept of absolute v/s relative URL that you will need to look into how subsequent URLs are resolved by browser.

301 or 303 redirect in html meta tag?

Recently I have moved my content from oldURL to newURL and I want to attain 301 redirect(document moved permanently), to achieve that I have used new html appology page with meta tag having the new url and http-equip="Refresh", something like follows;
<meta http-equiv="Refresh" content="0; url="newURL" />
I want to know that, will it return status code 301 or status code 303 ?
Also, if it is 303, please suggest me any better way that how should I achieve 301 redirect.
Thanks in advance.
I want to know that, will it return status code 301 or status code 303 ?
No. Meta elements in an HTML document are not handled at the HTTP level.
The HTTP status will be whatever the HTTP headers say (probably 200).
Use HTTP for redirects, not Meta.
You can do one of these two solutions. You can either :-
Create an htaccess file redirecting you to the new URL. There's more on how to do the task mentioned above here.
You can create a small error template in your old URL stating that it has been moved and post the link to your new URL.
In my opinion, I would recommend you doing the former because the user will not know the transition between pages.

Add content of one page to another

Can i add the content part of this link into my webpage
http://rid3201.org/site/club_members2.php?id=MTk3Ng==
I want to avoid the header part.Can i use iframe or object for this.
Use Html Agility Pack
With it you can get the whole page and select only the html element you need (I assume it would be table).
Then you can pass it to your page.
If you own the domain rid3201.org, you can do it with jQuery:
$('#result').load('ajax/test.html #container');
heads up!
If are not the owner of the domain, you CAN'T do it via jQuery.
The documentation of .load() says:
Due to browser security restrictions, most "Ajax" requests are subject
to the same origin policy; the request can not successfully retrieve
data from a different domain, subdomain, or protocol.
An alternative to jQuery is using XMLHttpRequest, coding with a backend language, like .Net
After you catch the url source, you have to clean the code to get only the div you want.