Need to add the requested URL on a "404"-page. [HTML] - 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).

Related

Why is 'noreferrer' not working on links?

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 .

TemplateDoesNotExist at /welcome_page/

I'm new in coding field. I decided to start a project with Django & Python, but I got stuck due to some errors. For the past 3 weeks, I tried to figure out what was the issue but couldn't find it. I will appreciate it if anyone help.
when I run my code, I get as an error, "TemplateDoesNotExist at /welcome_page/"
Everything as been specified but I'm still getting the same error
Here is the error page:
TemplateDoesNotExist at /welcome_page/
content of the welcome page:
Content of my the welcome page
my URLs :
URLS where I defined welcome page
My base content:
My base content
the place where the welcome page is calling from:
The place where the welcome page is calling from
My root to the welcome page from my C: drive:
My root to the welcome page from my C: drive
In your logout_request() view the last line is this:
return redirect("templates/welcomepage.html")
That's trying to redirect the user to a template. It should be redirecting to a URL.
In your urls.py the Welcome Page view has name="welcomepage" - this is what you use to refer to that URL. So change that line in your view to:
return redirect("welcomepage")
That will return the user to the "welcomepage" URL, which uses the views.welcome_page view, and the templates/welcome_page.html template.
By the way, if your welcome_page view is a class, as opposed to a function (I can't see it in your screenshot, so can't tell) then it's more normal in python to capitalise it: WelcomePage. Or WelcomePageView. Functions are lowercase (welcome_page).
If I see it right, you redirect to /templates/xxx.html but that path is not defined in your paths. The templates directory is the internal location, but the user can only see what is defined in the paths.
You should also better redirect ti the name of the page defined in the paths. Please post your settings.py maybe there is also a problem with the search path for templates.

HTML injection into someone else's website?

I've got a product that embeds into websites similarly to Paypal (customers add my button to their website, users click on this button and once the service is complete I redirect them back to the original website).
I'd like to demo my technology to customers without actually modifying their live website. To that end, is it possible to configure http://stackoverflow.myserver.com/ so it mirrors http://www.stackoverflow.com/ while seamlessly injecting my button?
Meaning, I want to demo the experience of using my button on the live website without actually re-hosting the customer's database on my server.
I know there are security concerns here, so feel free to mention them so long as we meet the requirements. I do not need to demo this for website that uses HTTPS.
More specifically, I would like to demonstrate the idea of financial bounties on Stackoverflow questions by injecting a Paypal button into the page. How would I demo this off http://stackoverflow.myserver.com/ without modifying https://stackoverflow.com/?
REQUEST TO REOPEN: I have reworded the question to be more specific per your request. If you still believe it is too broad, please help me understand your reasoning by posting a comment below.
UPDATE: I posted a follow-up challenge at How to rewrite URLs referenced by Javascript code?
UPDATE2: I discarded the idea of bookmarklets and Greasemonkey because they require customer-side installation/modification. We need to make the process as seamless as possible, otherwise many of get turned off by the process and won't let us pitch.
I would suggest to create a proxy using a HTTP handler.
In the ProcessRequest you can do a HttpWebRequest to get the content on the other side, alter it and return the adjusted html to the browser. You can rewrite the urls inside to allow the loading of images, etc from the original source.
public void ProcessRequest(HttpContext context)
{
// get the content using HttpWebRequest
string html = ...
// alter it
// write back the adjusted html
context.Response.Write(html);
}
If you're demoing on the client-side and looking to just hack it in quickly, you could pull it off with some jQuery. I slapped the button after the SO logo just for a demo. You could type this into your console:
$('head').append('<script src="https://www.paypalobjects.com/js/external/dg.js" type="text/javascript"></script>')
$('#hlogo').append('<form action="https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay" target="PPDGFrame" class="standard"><label for="buy">Buy Now:</label><input type="image" id="submitBtn" value="Pay with PayPal" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif"><input id="type" type="hidden" name="expType" value="light"><input id="paykey" type="hidden" name="paykey" value="insert_pay_key">')
var embeddedPPFlow = new PAYPAL.apps.DGFlow({trigger: 'submitBtn'});
Now, I'm not sure if I did something wrong or not because I got this error on the last part:
Expected 'none' or URL but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped.
But at any rate if you are demoing you could just do this, maybe as a plan B. (You could also write a userscript for this so you don't have to open the console, I guess?)
After playing with this for a very long time I ended up doing the following:
Rewrite the HTML and JS files on the fly. All other resources are hosted by the original website.
For HTML files, inject a <base> tag, pointing to the website being redirected. This will cause the browser to automatically redirect relative links (in the HTML file, CSS files, and even Flash!) to the original website.
For the JS files, apply a regular expression to patch specific sections of code that point to the wrote URL. I load up the redirected page in a browser, look for broken links, and figure out which section of JS needs to be patched to correct the problem.
This sounds a lot harder than it actually is. On average, patching each page takes less than 5 minutes of work.
The big discovery was the <base> tag! It corrected the vast majority of links on my behalf.

Using anchor tag to open a mailto and invoke a URL

With one of my requirements i need to open up the default mailing client with invoking a call to a service, this needs to be accomplished using anchor tags or purely html, the constraint is that we can not use javascript for the same.
Does anyone have any idea on how to accomplish this?
try this:
Click to Mail
This will open default mailing client.
Edit :
You may use onClick function to open new window and call you webservice url in it.like
Click to Mail
you can use like this
<a href="mailto:me#domain.com?subject=Call me&body=dummy mail:">
touch here</a>
try it
If you feel very very daring (and don't mind a horrible hack), you can try if
<meta http-equiv="refresh" content="1; url=mailto:foo#bar.baz" />
on your service page helps you. My brief check in FF suggests that since the new target starts an external program, the page doesn't go elsewhere. This might require some reshuffling of your service, depending on where exactly you want to spawn the mail window.

Background not displayed

What is wrong with my code \|/ I have copied the code from my other pages that work with the background but this one seems to just be blank. It will display anything but the background.
<body background="Music.png" bgproperties="fixed">
And before you say it, I have uploaded it in the same folder as the website. Here is my site: http://doomfire106.co.nf/Music.html
www.doomfire106.co.nf/Music.html is full of errors according to the W3C HTML validator. Most of these are harmless, but the duplicate <body> elements is not; remove the extra element. You also have content before your <body background="WebsiteBack.png"> element; content should be inside the element.
Sending an HTTP request for www.doomfire106.co.nf/Websiteback.png returns HTTP 500, Internal Server Error, so something is going wrong with your host when requesting that file. Check file permissions of your Websiteback.png file; it must have Read and Execute permissions for everyone.
The response looks like a PHP error message; do you have any filters on your site? Is your WebsiteBack.png page being generated by PHP?