I am currently using div id for users to go to my site and jump to div (ie sitename.com/sitepage/#div_1
). My issue is that if these urls are used adsense recognises this as autoscrolling and therefore displays the ad in a double-click format (ie user has to click twice to go to advertiser site as opposed to normal click once).
I do not want to use scrollto
script. However, I have found popstate is close to what I want but because the desired effect isn't the same across all browsers I want to use something simple like:
setTimeout(function() {
window.location.href = "#div1";
}, 1000);
The above will complete step 1 of my desired end result. However, I have multiple urls eg
sitename.com/sitepage/#1
sitename.com/sitepage/#2
sitename.com/sitepage/#3
Is there a way to recognise that if url contains # than insert "div" to url and respective number so it ties in with above code. My hope is something like below:
setTimeout(function() {
if(window.location.href.indexOf("#") > -1) {
window.location.href = "#divn";
}, 1000);
But I don't know how to say add "div" after "#"