This question already has answers here:
Remove http referer
(10 answers)
Hide Referrer on click
(8 answers)
Is it possible to remove the referrer in PHP before redirected?
(5 answers)
Closed 5 years ago.
I am working on a web with php (laravel 5.4) and I have to generate several links that the user clicking on them does not let you know that the click originated from my web page. The idea is that it seems that the user wrote the link directly in the browser, and that does not relate in any way that clicked from my website. how can I do it? Thanks for your help.
You can do that using javaScript. You need to define a function that accepts a url as parameter and calls the javascript window.open().
Make a regular tag and in its href attribute pass javascript:void(0); so that the default link click action is stopped.
Now define an attribute onClick and call your defined function here and pass the url you want to open.
Please see the example below:
<script type="text/javascript">
function openURL(url)
{
window.open(url);
}
</script>
GOOGLE
Related
This question already has answers here:
Javascript onclick function is called immediately (not when clicked)? [duplicate]
(1 answer)
Why is this javascript function running without being called?
(4 answers)
Javasctipt function running without being called? [duplicate]
(1 answer)
Closed 4 years ago.
The code is supposed to redirect the user to another internal page. However when the page loads with the code in it it automatically redirects the user without the user having to click the button.
I'm pretty new. I don't know what to try. I think it should work as is.
document.querySelector(".choice").addEventListener('apple', Redirect());
function Redirect()
{
window.location = "challenge.html";
}
The expected result is that the user would click the text that contain the choice class and it would redirect the user to the challenge page.
The actual result is when the page loads it automatically redirects the user to the challenge page without the user having to click the button.
You are invoking the event handler in this line:
document.querySelector(".choice").addEventListener('apple', Redirect());
Remove the parentheses:
document.querySelector(".choice").addEventListener('apple', Redirect);
You need to pass a reference to addEventListener otherwise with your current setup not only will the user be redirected immediately after the listener is registered, the button will also do nothing because the Redirect function is not returning something
This question already has answers here:
Check if event is triggered by a human
(9 answers)
Closed 4 years ago.
I have some images that are clickable. for each click , users can get some point.
But I want to prevent clicks that do by bots. in fact I want a way to detect that a real user is clicked or a bot.
I want do that in javascript or jquery. if anyone know a plugin that can do that Please introduce me to it.
You can simply assume it’s human, provided access to the page is protected by reCAPTCHA, and subsequent requests carry a CSRF token.
This question already has answers here:
What do querySelectorAll and getElementsBy* methods return?
(12 answers)
Closed 6 years ago.
I need a javascript bookmarklet that will click on a button within a web based program I use for work. It is just the refresh button for part of the page. The element information (from Google Chrome's developer tools) is listed below.
Refresh
I tried this:
javascript:document.getElementsByClassName("Ref btn btn3d TableBtn").click();
Seems to do nothing.
I haven't messed with bookmarklets or javascript in a very long time, but I know something like this is possible.
You're getting an array returned to you. Trying to click on it is failing because even if there is only one matched element, you still aren't running your click function on it. You need to run your click function on that specific element by picking it from he returned array.
var button = document.getElementsByClassName("Ref btn btn3d TableBtn")
button[0].click()
The exact syntax you would use in your bookmarklet would be;
javascript:var button = document.getElementsByClassName("Ref btn btn3d TableBtn"); button[0].click();
This question already has answers here:
Quickest way to pass data to a popup window I created using window.open()?
(6 answers)
Pass a value from Parent to Child (Open) window
(2 answers)
Closed 6 years ago.
In my application, i need to open a popup and display some results coming from a Javascript function. I open the popup window with the command:
var popup=window.open('popup.html', 'width=500', 'height=500');
where popup.html is an html page that calls the chart.js library for showing some graphs. I need to pass data to this window in order to display the correct graph. I tried a lot of examples, but none worked. How could i solve this problem?
Luca
You could pass basic data in the url hash, change your JS to
var popup=window.open('popup.html#MY_DATA', 'myWindow','width=500,height=500');
and then in the popup.html page you can access the it by looking into the location.hash variable:
window.location.hash
//This will be "#MY_DATA"
This question already has answers here:
PHP Header redirect to Multiple URLs with a time gap
(5 answers)
Closed 7 years ago.
I have a link and when the user clicks it, it takes them as follows:
header('Location: www.mysite.com/part2.php');
I would instead like to take the user to part1.php for a couple of seconds before taking them to part2.php. User clicks,
part1.php is visited for a few seconds, then part2.php is visited. part1.php is used as a gateway so it somehow has to know the request came from the link to pass over to part2.php
Is this possible?
This is possible using JS. Put the code below on part1.php
setTimeout(function () {
location.href = 'part2.php';
}, <delay in milliseconds>);
Short answer... no.
Long answer. You will need to issue the redirect in part 1 to redirect then to page 2. You can do so using the meta redirect tag, or using a javascript timer on page 1, so that page 1 is visible on the browser before the page 2 appears.
See here for how to use meta refresh...https://en.m.wikipedia.org/wiki/Meta_refresh