473,378 Members | 1,280 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Redirect Website if its not specified domain in script - Protection using Javascript

Brief Idea: I am building script for protecting my webdesign work by locking them on Single domain. If website is uploaded on different domain, It will redirect to my website. Means it won't allow to load actual website from different domain except I specify them.

My Working Script:

-- DECODED SCRIPT --

Expand|Select|Wrap|Line Numbers
  1. []['constructor']['constructor'](self['unescape']('if(~location.protocol.indexOf('http:')&&~location.host.indexOf('isupportu.in')){}else(location.href='http://iamwebdeveloper.in')'))()
Here on above code, I am allowing my work to load on "www.abc.com" with http protocol only. However it won't work if we load website without www i.e. "abc.com".

www.abc.com --> Website load

abc.com --> www.iamwebdeveloper.in

xyz.com --> www.iamwebdeveloper.in

www.xyz.com --> www.iamwebdeveloper.in
I decided to use .htaccess / web.config file to force redirect domain without www. request to www.abc.com [which is working very well]

But now I want to upgrade this script and I need your help:

Don't want dependency on .htaccess / web.config file for redirecting non www. request.
www. and non www request should accept, but no subdomain allow. For e.g. subdomain.abc.com is not allowed.
I want to add multiple domains in script for big clients who has multiple domain for their single website as Addon domain. I want to add more domain in above script.
I hope this will be more interesting task for you too, same as mine.


Can someone help me to validate this script for my above logic ?
Expand|Select|Wrap|Line Numbers
  1. []['constructor']['constructor'](self['unescape']('if(~location.protocol.indexOf('http:')&&~location.host.indexOf('isupportu.in')||~location.host.indexOf('site2.in')||~location.host.indexOf('site3.in')){}else(location.href='http://iamwebdeveloper.in')'))()
Apr 12 '13 #1
2 1712
Dormilich
8,658 Expert Mod 8TB
what if I remove that redirecting line? it’s only JavaScript, after all.
Apr 12 '13 #2
I am agree with you but I am injecting this code in multiple JavaScript include in jQuery script and encrypting all js. Nothing is foolproof protection but at least we can slow them.
Apr 13 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Tony Strazzeri | last post by:
Hi, I recently posted "problem with Javascript code from Include" Thanks to response I have now fixed the problem. This is to ask how to solve my next problem/step. I am using javascript to...
4
by: zborisau | last post by:
Hey good people, I've been given a problem to solve recently - and stuck with the solution for a good 4 days already. i have a link which leads to popup window. the purpose of that popup...
3
by: mrwoopey | last post by:
Hi, I am using the example "Authenticate against the Active Directory by Using Forms Authentication and Visual Basic .NET": http://support.microsoft.com/default.aspx?scid=KB;EN-US;326340 ...
1
by: Leszek | last post by:
Hi I have user-side javascript that validates a form. And I have server-side php script thad does the same. Is it possible to disable php script from showing messages about missing values if...
6
by: sales | last post by:
Hello, I am trying to get my website checkout page to rotate / take turns displaying shopping comparison engine surveys rather than display them all 4 at the same time, thus overwhelming &...
6
by: bushi | last post by:
hi everyone! i have diplayed my hyperlinks in a iframe.when i redirect to next page.the next page also open in the same frame,but i want to open a new browser window,when i click on the...
2
nirmalsingh
by: nirmalsingh | last post by:
hai all, i am having 2 pages. login.html and city.html login.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">...
25
Death Slaught
by: Death Slaught | last post by:
I need to know how to make a username and password login screen for an online game that im making and i need it so i can access that person account and look at their password or edit their account so...
2
by: davidson1 | last post by:
Hai friends..for menu to use in my website..i found in one website....pl look below website.... http://www.dynamicdrive.com/dynamicindex1/omnislide/index.htm i downloaded 2 files.... ...
3
by: zac540 | last post by:
Hey everyone! First of all I'd like to say that I did my best to look for any other relevant posts. The best I found was this interesting thread.. http://bytes.com/forum/thread594982.html If...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.