Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I'd like to know how I can have a link to an external page that is not visible to adblock users.
I have tried many things including giving it a div id="ad", and iframes. Is there maybe something I have missed?
Here is a very simple example. I display the GoogleAdsense logo outside of the screen. If the image has no height it was blocked -> there is a AdBlocker
<html>
<head>
<title>AdBlock Detector</title>
<script type="text/javascript">
//Is there a AdBlocker?
function isAdBlocker(){
var a = document.getElementById("adTest");
return a.offsetHeight==0;
}
//Hide all Links tagged with 'add="true"'
function protectLinks(){
if(isAdBlocker()){
var links = document.getElementsByTagName("a");
for(var i=0; i<links.length; i++)
if(links[i].getAttribute("ad"))
links[i].style.display="none";
}
}
</script>
</head>
<body onload="protectLinks()">
You can't see this link with enabled AdBlocker
<a ad="true" href="http://google.de">Link to Google</a>
<img id="adTest" style="position:absolute; left:-5000px" src="https://www.google.com/images/logos/adsense_logo_sm.png">
</body>
</html>
Insert the little Script and the "adTest" div in your Blog and give all links you want to protect a ad="true" attribute.
(And don't forgett to call the protectLinks() function after page is loaded.)
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 days ago.
Improve this question
Code I think
the door + text
the door changes into a open door after clicking it but is there a way for the 'woah' to change into for example 'text2' after clicking the closed door??
I'm new to html so I don't know much
someone told me to use document.getElementById but didn't give me any more information and I do not know where to put in the id
You can achieve what you want with basic Javascript, but if you don't know it yet, consider finding some good tutorial to get started.
The code you're looking for is something like
<!doctype html>
<html>
<head>
<title>Update Image and Text</title>
<!-- Define your function here -->
<script>
function updateImageAndText() {
//Update image url
document.getElementById("image").src = "https://via.placeholder.com/150/FFFF00/000000?text=open+door";
//Update paragraph text
document.getElementById("text").innerText = "New text";
}
</script>
</head>
<body>
<img id="image" src="https://via.placeholder.com/150/FFFF00/000000?text=closed+door" onclick="updateImageAndText()" />
<!-- Call your function here -->
<p id="text">Initial Text</p>
</body>
</html>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
JSFIDDLE: http://jsfiddle.net/t9h6W/
<body style="margin:0 0 0 0;background-color: #f4f4f4;">
<div>
The JSFiddle has all the code.
</div>
</body
Everything seems to be fine, I don't understand why the Facebook Social Plugin isn't working? More-so, how would i reposition the social plug in inside the login form that I have present on the page? No Idea why it isn't working :/
It says,
Invalid App Id: Must be a number or numeric string representing the application id.
Open your browser console and you will see Javascript error.
To reposition the FB login button, you can place the code inside a div and control the div to position the box.
ie., put the fb embed code inside a div like this,
<div class="fb-login">
<fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>
</div>
Now you can apply style to 'fb-login' class to position the fb button.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Can someone please help me solve this problem. I want to show a submit button when users click on the anchor tag. The problem is, the button is initially hidden, but when I click on the anchor tag, nothing happens
The HTML code is as follows:
<html>
<head>
<style>
#reveal
{
visibility:hidden;
}
</style>
</head>
<body>
<div>
<a href="javascript:" onclick='showButton();'>k...#ccs.neu.edu</a>
</div>
<form>
<input type="submit" value="show email address" id="reveal"/>
</form>
<script type="text/javascript">
function showButton() {
document.getElementById("reveal").style.visibility = visible;
}
</script>
</body>
</html>
Use document.getElementById("reveal").style.visibility = 'visible'; instead of document.getElementById("reveal").style.visibility = visible;
You do not want to assign a variable, but a value, which should be put on quotes.
Use 'visible' instead of visible. You want to use a value, not a variable there.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm having a real problem with target _blank. The website is this: http://www.l2herbal.com/ When I placed a link with target _blank in the menu ('Forum') if the user clicks on it, it opens in a new tab BUT the problem is that http://www.l2herbal.com/forum remains in the old address bar. I've checked all the js but found nothing.
Chrome, Mozilla, IE acting the same.
It's an issue with this script: http://www.l2herbal.com/js/scrollTo.min.js
Here is a code that changes window URL:
window.location.hash = d
You applied it to all menu links in http://www.l2herbal.com/js/main.js:
$('#nav-boxes a, .logo a, #nav a, #navmobile ul a').scrollTo({ duration: 'slow' });
Change #nav-boxes a selector to exclude forum url.
Inspecting html from your site I did found href="/forum"
Place a dot(.) before /forum in href to indicate forum in current(root) directory
Use
<a style="width: 16.6667%;" class="menu-5" href="./forum" target="_blank">
<div></div><span>Forum</span></a>
Instead of
<a style="width: 16.6667%;" class="menu-5" href="/forum" target="_new">
<div></div><span>Forum</span>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I'm trying to use <img src=... for this image http://www.quirksmode.org/mobile/pix/viewport/mobile_visualviewport.jpg
When I open up the image in browser by typing clicking the url, the image shows up.
However, when I try to show the same image by using <img src=..url /> , the image is not found and not shown.
What causes this difference?
Works for me:
<html>
<head>
</head>
<body>
<img src="http://www.quirksmode.org/mobile/pix/viewport/mobile_visualviewport.jpg">
</body>
</html>
Following code should be work: Please Try this,
img src="http://www.quirksmode.org/mobile/pix/viewport/mobile_visualviewport.jpg" /
P
Simply try this http://jsfiddle.net/aMYra/
<img src="http://www.quirksmode.org/mobile/pix/viewport/mobile_visualviewport.jpg" />