Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Hey any one know how to prevent users to use ad blocker on my site.I just want to request them not to use it on my site..
Make a Javascript file called advertisement.js with this code:
var noadblock = true;
Include it on your page somewhere:
<script type="text/javascript" src="advertisement.js"></script>
The idea is that adblock will block the file called advertisement.js and your var will never be created. So you can use this to take action based on whether the var exists or not:
window.onload = funtion(){
if (noadblock){
// no adblock
}else{
// adblock detected, do stuff here
}
}
Updated cus somone in the comments had a better idea.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
So I was wondering if there is a way to hide you're activity from a webpage that uses JavaScript (And libraries such as AjaX or JQuery).
By activity I mean that I don't what the webpage to know that I'm switching tabs or minimizing the browser, unfocusing and etc.
I know you can track someones activity like so:
$(window).focus(function() {
console.log("YOU'RE BACK")
});
$(window).blur(function() {
console.log("YOU'RE OUT")
});
And I can stop it by writing the following in the console:
$(window).off()
But I'm sure there are million other ways to do so, and I want to make sure that any specific webpage doesn't do so.
So, How can I make sure that no sensitive information leaked?
also note that I don't want to block JavaScript completely, because I want the webpage to still work.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
How could I use PHP or Javascript to check if a user's previous page was a certain page on my site and then if so, show an alert box?
This could be circumvented if a person really wanted to.
//on the page for the alert
session_start();
if($_SESSION['lastPage']=='??'){
echo 'alert';
}
//on the page you want to detect if the user came from
session_start();
$_SESSION['lastPage']=$_SERVER['REQUEST_URI'];
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
How to make a simple button saying "Next" that redirects you to a random page in the same tab of the browser? Like a refresh of the page but switching to another page. Just a simple button that changes the page randomly from a number of pages introduced there.
You'll need to do this in three parts.
First, set up an array of websites to redirect to:
var arrayofsites = ["www.google.com", "www.facebook.com", "www.stackoverflow.com"];
Second, randomise which site is selected:
var randomsite = arrayofsites[Math.floor(Math.random() * arrayofsites.length)];
Third, redirect the user to the site randomly chosen:
window.location.replace(randomsite);
Hope this helps.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have forum v bulletin
I need to redirect a visitor to redirect.php page automatically after a short delay,countdown redirect ,
when he clicks download attachment or external link.
Is there any possible way to do that in a .htaccess (JavaScript) code or any thing ..
it is simple but you should Google for it
var delay = 100;
var button = document.getElementById("id o button");
button.onClick = function(){
setTimeout(function(){
window.location = "http://www.yoururl.com";
},delay)
};
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to insert a value in database when visitor click on a link.
For example:
Visitor comes on http://www.website.com/lp.php?id=broker
When he clicks on "Register now" I want to add the id value "broker" & the current time into database.
I need the javascript code to do that. I already tried all kind of scripts and I decided to ask here.
You can do this with jQuery Ajax and PHP or using HTML POST form.
http://api.jquery.com/jquery.post/
With jQuery:
$("#register_now_button_id").click(function(){
//AJAX CALL HERE
});