Aiden Stewart Aiden Stewart - 5 months ago 8
PHP Question

Show a blank_page with no URL after open a link

I googled my question but it seems there is nothing about it on whole internet!

I have a html link that goes to a php file.That php file redirect to link for downloading a RAR file.But after download i have a page with my php file address that i dont want to be seen.i want to add another header to the php file that redirect to a blank_page that has nothing even a url.

Actually, i see many websites that using this trick,

is there any way to do that with php or js or even jquery and ... ?


this is my php file code:

header('Location: http://~~~~~~.com/xxx.RAR');


Answer

You can use this simple JavaScript snippet to edit the browser history + url. The following code will set the URL to the parent domain. "Example: YourDomain.com"

history.replaceState( {} , '', '..' );

You can add this snippet to the onLoad Event of the page.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>

<body onLoad="history.replaceState( {} , '', '..' )">
</body>

</html>