-2

java experts,

i am myself a template developer, i offer free and premium template, some users when download our free templates they remove the footer link...so i prepared some scripts and now they dont remove footer link by any way except they do add some css properties to that existing id.

SO my question is here:

suppose below is my template:

<html>
<head>
</head>
<body>

<div id='copyright'/>

<style>
#copyright{font-size:10px;position:relative;display:block;}
</style>

</body>
</html>

As you see the above #copyright holds 3 css properties
1:font-size:10px;
2:position:relative;
3:display:block

Now i want that if a user try to add extra properties to that id, then the page should be redirect to xyz.com ..got it ?

Lets take example: suppose the user when download the template he add float:right property to the existing id like this:

   <style>
    #copyright{float;right;font-size:10px;position:relative;display:block;}
    </style>

now the page should be redirected to xyz.com because one extra css property added to the id...it means the id #copyright should only keep my own set of properties, if added any other then the page should be redirect.

Summary:

i have a template i set my own style for id #copyright, i want that if users add extra css tag/properties to the same id #copyright, then the page should be redirect.

example of script, its idea in my mind. it should be some like that

if <id copyright> has only these list of properties 
   (
   #copyright
   {float;right;
  font-size:10px;
  position:relative;
  display:block;}
{
// do nothing
}
else
 {
 window.location.replace("http://example.com");
}

I hope someone will make script for me like above idea, where i add my own css properties for id #copyright.

Sky Rocket
  • 29
  • 7
  • It sounds like you are looking to prevent user's of your themes from hiding your copyright link, am I correct? You're going to find that this will not work for you. For example: lets say you develop this script that works exactly as you are hoping - what's to stop the user from dequeuing your script? Or adding another script to detect a page redirection to xyz.com and cancel it? This is not an issue there is a technical solution for. Your best bet might be to add conditions to your license agreement that the user will not modify this - if you are using an open source license this may be hard – Chris O'Kelly Feb 17 '16 at 01:17
  • So... just so you know... this wouldn't serve much of a purpose. If they access to the template (or even if they have ability to run js after it loads) they could simply change the "id" on the element... or numerous other things like having js insert inline styles. – Goblinlord Feb 17 '16 at 02:22
  • @ChrisO'Kelly but you forgot that i mix the js with another js of my template and then encrypt it, so users cannot remove or modify the js. if they remove the js along the widgets and plugin will stop working. i hope you got, how i prevent them. but still i need only this script that i describe. – Sky Rocket Feb 17 '16 at 11:12
  • @Goblinlord but you forgot that i mix the js with another js of my template and then encrypt it, so users cannot remove or modify the js. if they remove the js along the widgets and plugin will stop working. i hope you got, how i prevent them. but still i need only this script that i describe. – Sky Rocket Feb 17 '16 at 11:12
  • Do I forget that, or did you never include it in your question? That's fine, so assuming that we cannot modify or remove your JS whatsoever, I just enqueue another javascript file containing the following: `window.onbeforeunload = function (e) { var e = e || window.event, msg = 'Let Sky Rocket Redirect you?'; if (e) { e.returnValue = msg; } return msg; };` : when your redirect would occur, I get a message `Let Sky Rocket Redirect You? [OK] [Cancel]` which I can just click cancel on. – Chris O'Kelly Feb 18 '16 at 02:24
  • Or what about this - I create a div with width and height at least equal to `#copyright`, and background color the same as the background behind it. Then I absolutely position this div on top of the copyright div, hiding it visually without any detectable html or css change to `#copyright`. What I am trying to say is that your goal is conceptually impossible – Chris O'Kelly Feb 18 '16 at 02:29

1 Answers1

0

No. It is not possible to perform redirects in CSS; however, you can show or hide links using CSS.

I think you're confusing Javascript with CSS. Although historically, CSS has had the ability to evaluate expressions and execute javascript, these features have been removed for security reasons. This is for the better, as it forces us to think of our solutions independently.

If you wish to show/hide corresponding links, you can do so with display: none/display: inline-block. But it sounds like you want to replace the link, in which case, you should look to javascript or a server-side templating language to do so.

user1429980
  • 6,872
  • 2
  • 43
  • 53
  • you means javascript cannot figure out the value of css properties..means it cannot read it where new properties included or not.. – Sky Rocket Feb 17 '16 at 01:08