Login being blocked by adblocker - javascript

I am wondering, because I got a website login script and it uses this command:
if(document.getElementById('linkreg'))
document.getElementById('linkreg').onclick = function ()
{
ajaxSend(php_fileusr, 'susr='+texts['register'], adboxshow);
objLogare.adLogInr();
return false;
};
Anyways, this function is triggered when the register for a new account (same thing for recovering account but different script). Anyways, some users weren't able to register because the window never popped up. I figured out that this is caused by the adblock extension. I am wondering if there is any way to replace the command adboxshow. Does anyone know any alternatives that work the same but won't be blocked?

Thanks to comments from Poke and Cezary, I figured it out
If I was an adblocker, and would see a function called adboxshow, I
would certainly block that as well. Can’t you rename it to something
more sensible? It does indeed sound as if you want to show an
advertising box here… – poke yesterday
Adblock is designed to block containers/scripts/css classes, that has
"ad*" prefix. You should avoid that, even if it's short for "awsome
dynamic" ;) – Cezary Daniel Nowak yesterday
I changed every function, class, or div that had the word "ad" in it, specifically starting with the word "ad" in order to make it compliant with ad blocker.
-I hope this helps others who are trying to make a website that has legitimate content that is not blocked by adblockers.

Related

I want a codes which redirect to my website when JavaScript used on wrong site

I want to secure JavaScript Codes. I secure my JavaScript with https://javascriptobfuscator.com/ but it can also stolen from view source.
I want a codes which redirect to my website when JavaScript used on wrong site.
This is possible I know but I don't know how?
What you could do is check the return of location.host or location.hostname.
To redirect to another URL you would change the value of location:
location = "https://mywebsite.com";
//or alternatively
location.assign("https://mywebsite.com");
However, the redirection may will be prevented by Cross-origin resource sharing policies (see Michael's comment). So you could just display an alert dialog.
alert("Don't use my script on your website");
The person trying to use your code on their website will be warned during development by this alert.
In any case, your obfuscated code can still be changed and someone that is determined will remove these "security" measures and it can even be deobfuscated.
Are you sure all of this is needed ? Modifying a stolen code to make it work on another website can be harder/longer than just rewriting a similar code. Apart if you are doing something very special and new, I think you are just losing time by trying to protect your code.

Javascript "link" should not load

I know it sounds weird, but i need to make that…
So I have this function, that activates onClick.
function opensite() { location.href='https://www.site.com/'; }
Is there a way to open that url, but not load it?
So your browser will say something like "page not found/server down/no internet connection"…
Is it possible and how ? My server can use every language … (JS,JQUERY,PHP,HTML…)
Why I should do this ? Long story, please don't ask about ;)
Thank you
Evert
*EDIT*
I have a script that perfectly works without internet connection because it doesn't load the page in the 'link'… I'm trying to make this also work WITH internet connection...
Are you looking for this?
window.open('http://www.site.com/')
But some browser will block the pop-up window. There's also another way:
var a = document.createElement('a');
a.href = 'http://www.site.com/';
a.target = '_blank';
a.click();
to emulate a click on a link.
If you own the site you are trying to make appear offline, then the easiest way is to upload an index.html containing the error you are trying to display.
But really, no. This is not possible.
I am assuming you do not own the other site, and due to security reasons, browsers block this type of behavior. Since you are asking to bypass security settings, and telling us "don't ask" I can only assume you are trying to steal peoples identities.
No matter how bad you need this to work, it wont. Stop trying.
Edit:
If you simply do not want your website to follow a click, then I would use e.preventDefault() in your jQuery event handler

appMobi / phonegap setting/deleting cookie click action required 2 times before working?

I can't figure out for the life of me whats up with this. I dunno if this is appMobi/phonegap centric, cause they have there own special ways of setting cookies, and handling them. But I have what seems to be a unique problem overall, and it only occurs in the process of actually writing a cookie for the first time. Or removing it if it exists which is kind of like writing it.
Anyway I have 2 functions that worked perfectly up til the point of introducing the cookies to them. But I need the cookies also as its part of a login check, and a handful of other things. So this is my issue.
I type my user/pass, hit login. get nothing. hit login again, works.
I hit logout after being logged in, nothing works. hit it again.. works..
These are ajax driven functions as well. Dunno if that has anything to do with it or not, but in both cases cookies are being written in one shape form or another and thats when the functions seem to break in respect to the fact that I need to click the buttons that trigger them twice to get the desired effect despite them being a single click action.
If I remove the cookie lines from my functions everything works normally again without problem, with exception that the cookies are required to actually use half the stuff I am building. Also its a lone cookie being written with a numeric value.
Ideas?
AppMobi.cache.setCookie('AutoRemember', uid, 90);
This one line if its there, i have to double click for my functions to work, if its not there my functions work as expected..
a sample of one of my function would be (quickly typing one out here for example sake)
$('#buttonX').click(function(){
url = 'http://www.domain.com';
$.post(url, function(data)
{
if(data.status == "good")
{
AppMobi.cache.setCookie('AutoRemember', uid, 90);
window.location = 'dashboard.html';
}
}, 'json')
});
Ah yes, I ran into the same thing. You'll need to download and init the local_bootstrap.js lib and something from "Develop In Eclipse For Android " (I downloaded the .zip "appMobi Cloud Services library for PhoneGap Android development"). I'm doing the Android app with Eclipse, and I assume you are too, your post didn't mention what IDE you were using.
The .zip file has a great readme.txt on where & what to copy (.java files, jar file, etc.)
found here: http://www.appmobi.com/?q=node/85
Well, come to find out or as far as I can figure at least. This appears to be a glitch between browser and emulator more so than it is my coding. When I run the app in the sandboxed appMobi application from "Test Anywhere" things work as expected all around.
I will be opening up a bug ticked on appMobi where every they take bug reports and I will come back here with a link later so others may follow it as well when and if they come across a similar issue.

Bookmarklet window.open blocked by most browsers, delicious/tumbler's does not

Hey guys --
The website I'm working on requires a bookmarklet launchable from your bookmark toolbar.
I've noticed that some browsers are blocking my bookmarklet.
However, similar bookmarklets such as Tumblr's, Twitter's, and Delicious' have workarounds where their bookmarklet pages are not getting blocked.
My current launch script looks like:
javascript:void(window.open(%22http://mywebsite.com/share/form?
u=%22+encodeURIComponent(location.href)+%22
&t=%22+encodeURIComponent(document.title),
%xz%22,%22status=0,toolbar=0,location=0,menubar=0,resizable=false,scrollbars=false,height=379,width=379%22));
It's a simple window.open, which is clearly not enough to handle certain exceptions
The sites, below is Delicious' launch script, all seem to have workarounds that look very similar to that of below:
javascript:(function(){
f='http://www.delicious.com/save
?url='+encodeURIComponent(window.location.href)+
'&title='+encodeURIComponent(document.title)+
'&notes='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+
'&v=6&';
a=function(){
if(!window.open(f
+'noui=1&jump=doclose','deliciousuiv6','location=yes,links=no,scrollbars=no,toolbar=no,width=550,height=550'))
location.href=f+'jump=yes'};
if(/Firefox/.test(navigator.userAgent))
{setTimeout(a,0)}else{a()}})()
It seems like they append some extra GET parameters to the URL if the user agent is firefox.
I'm assuming then, if that is the case, that the init scripts on the actual page loading from the bookmarklet handles this exception somehow?
Has anyone had any experience with this issue? Would you be able to point me to any resources or tips? I have been stuck with this roadblock for sometime now.
Thanks in advance
the delicious bookmark does not directly invoke the window.open() - it creates a function (called a in there) which is then executed in a setTimeout(a,0) for firefox (i assume the problem you have is in firefox).
You can try a similar method, and see if it works for you.

swf file to just delete flash cookies

I'm trying to find a javascript method to delete flash cookies on a page, but with no luck.
I know it can be obviously done through flash or flex, but the problem is I know nothing about flash, flex and actionscripts...So my question is: Is there a way to just load a prebuilt flash movie in a page, which just programmatically deletes all the flash cookies it finds? Could any of you please make one for me? I could find some actionscript code around the internet and didn't look complex, but I don't know how to use it...
Thanks in advance!
A Flash cookie or SharedObject is defined with a name & a path. In order to clear it, you must first retrieve it using those values.
var mySoName:String = "name of your sharedObject";
var mySoPath:String = "path to your sharedObject";
var mySo:SharedObject = SharedObject.getLocal(mySoName , mySoPath);
After this you can simply call the clear() method to delete its data , the reference still remains though.
mySo.clear();
If you don't know what the values are for name & path, I'm afraid I don't know how you can deal with this.
I'm not sure that it's possible to delete ALL flash Shared Objects from a webpage.
The Flash sandboxing / security rules means that SOs aren't cross domain. This means that one site cannot poison or steal SOs for another site.
This (unfortunately for you) means that a site cannot delete ALL the SOs using Flash.
As far as I know, the only way to really remove all the SOs is to go do it yourself. (There's a few programs to manage / help you do this I believe)
There are global security settings which can block all new SOs from being created, but that doesn't (last time I looked) clear up the ones that already exist.

Categories

Resources