Site Map
Tools
Authorizations:
›› remove

 

unlock Attribute

When Internet users want to gain access to paid access premium content, they must click a paid-link. A paid-link has the same purpose as a regular link, i.e. to load content - a web page, a photo, etc. - from the website server to the user's browser. The difference is that in addition to this, the paid-link also "unlocks" the premium content as soon as users pay for it.

When we say that certain content of a website has paid access, this means that the web server that serves the website pages must only send such content to the users that have paid for it. This is called "access control" and is accomplished using the iCents Access Filter software or other software which runs on your website's server.

When an Internet user clicks a paid-link, iCents.net creates an Authorization based on the paid-link attributes, one of which is unlock. This is the authorization that tells the website server that the user has permission to access the content. This authorization is stored in the browser cookies and will be deleted if the cookies are deleted.

The unlock attribute of the paid-link indicates which content must be unlocked when the user clicks the link. The unlock attribute is always case sensitive, i.e. it differentiates uppercase from lowercase letters.

When no content must be unlocked

When you do not wish to unlock content, set unlock="none". This allows the paid-link to operate normally, but no content will be unlocked. This is often used only during the development of the web pages, for testing purposes, or in rare situations such as donation links.

When content must be unlocked

When a link has been paid for, you usually want to unlock the content for the user to view it. The unlock attribute indicates the URL of the content that must be unlocked for the user when the link has been paid. Notice the difference between the href and unlock attributes:

When using both the href and the unlock attributes in a paid-link, you may simultaneously unlock and exhibit content.

The unlock attribute must indicate an absolute URL

According to the HTML specification, the href attribute of a link could be either relative or absolute. Absolute means that you must insert the full URL address, while relative means that only the position relative to the web page URL that contains the link is inserted.

However, the unlock attribute must always be absolute.

Suppose that the two following links are within one file, such as http://www.example.com/page.html. Then both links point to the same image, but only the first one will unlock the image when the link is paid:

<a href="http://www.example.com/image.gif"
 unlock="http://www.example.com/image.gif"
 price="US$ 0.1">paid-link</a>

<a href="image.gif"
 unlock="image.gif"
price="US$ 0.1">paid-link</a>

When unlock is equal to href

It is common for the unlock attribute to be equal to the href attribute. For example:

<a href="http://www.example.com/image.gif"
unlock="http://www.example.com/image.gif"
price="US$ 0.1">paid-link</a>

In this example, "image.gif" is an item of the content that is locked only to paying users. When the user clicks the link and makes the payment, this image will be unlocked and then be loaded into the user's browser.

 

To make it easier to develop and test your web pages, if you omit the unlock attribute, and the href is a valid URL (http, https or ftp), iCents.net will cause unlock to be automatically equal to the absolute href of the link. For example:

Suppose that the 4 following links are within a file such as http://www.example.com/page.html. Then the 4 following links are identical:

<a
href="http://www.example.com/image.gif"
unlock="http://www.example.com/image.gif"
price="US$ 0.1">paid-link</a>

<a
href="image.gif"
unlock="http://www.example.com/image.gif"
price="US$ 0.1">paid-link</a>

<a
href="http://www.example.com/image.gif"
price="US$ 0.1">paid-link</a>

<a
href="image.gif"
price="US$ 0.1">paid-link</a>

Attention: Please note that when you really do not want to have unlock (that is, when you do not want any content to be unlocked), then you must not omit the unlock attribute, but set unlock="none".

When unlock is different from href

You may want to define unlock different from href because in many situations you will need to unlock a large quantity of content at once.

In the following example, make the payment to cause the link to open a page with two images in a frame. The link must at once block not only the page but also the images contained in the page.

click here to see the image page

The link takes you to image.html, but unlocks all the files that begin with image, including image.html, image1.png and image2.png.

Please note that the link uses the appendable attribute to unlock more than one content item at once using appendable="true".

 

Another reason for which you may want to define the unlock attribute to be different from href is that the link does not always need to operate like a conventional link, but execute a JavaScript/Ajax command. If the JavaScript loads some content, it is necessary to unlock this content before loading it. In the following example, the link does exactly that, executing a JavaScript command that loads an image:

click here to load an image below

We use the onafterok attribute to create an event that executes a JavaScript command right after the user effects payment. The JavaScript in question loads an image that is unlocked via unlock.

Note: we set href="icents:" to indicate that the link is not to be followed. This is the same as setting href="javascript:;" or href="javascript:void(0)".

Using the Query String and the Fragment Identifier

Query String

A Query String is the part of the URL that comes after the ?.

For example, in the URL: http://example.com/process.html?name=Alice
the Query String is name=Alice

Normally, the Query String is used to provide parameters to the server. In the previous example, the script "process.html" will receive the information "name=Alice", and will carry out some process related to the name "Alice".

iCents.net considers that two paid-links with unlock attributes that contain different Query Strings must unlock different content. For example, the following two unlock commands are different, therefore it is possible to create a paid-link that only allows the processing of Alice, and another that only allows the processing of Bob:

<a href="http://www.example.com/process.html?name=Alice"
 unlock="http://www.example.com/process.html?name=Alice"
 price="US$ 0.03" duration="10">Process Alice only</a>

<a href="http://www.example.com/process.html?name=Bob"
 unlock="http://www.example.com/process.html?name=Bob"
 price="US$ 0.03" duration="10">Process Bob only</a>

 

Otherwise, we could use the appendable attribute to allow for the use of any Query String:

<a href="http://www.example.com/process.html?name=Dave"
 unlock="http://www.example.com/process.html?" appendable="true"
 price="US$ 0.05" duration="15">Process Dave but allow all</a>

 

On the other hand, it is also possible to prevent the use of the Query String by simply not placing the Query String in the unlock attribute and by omitting the appendable attribute:

<a href="icents"
 unlock="http://www.example.com/process.html"
 price="US$ 0.01" duration="20">No Query String allowed</a>

 

See below how the examples mentioned above function:

Process and unlock Alice only

Process and unlock Bob only

Process Dave, but unlock all

No Query String allowed

Fragment Identifier

A Fragment Identifier is the part of the URL that appears after the #.

For example, in the URL http://example.com/info.html#chapter1
the Fragment Identifier is chapter1

Normally, the Fragment Identifier is used to open a web page at a specific position other than the top of the page. For example, this link opens a page at a specific position.

The paid-links whose unlock attribute contains different Fragment Identifiers are considered to be equal, because unlock ignores everything that comes after #. For example, the unlock commands of the following three links are considered identical, and for this reason the purchase of any one of the links unlocks all of them:

<a href="http://www.example.com/info.html"
 unlock="http://www.example.com/info.html"
 price="US$ 0.03" duration="10">Open in the beginning</a>

<a href="http://www.example.com/info.html#chapter1"
 unlock="http://www.example.com/info.html#chapter1"
 price="US$ 0.03" duration="10">Open Chapter 1</a>

<a href="http://www.example.com/info.html#chapter2"
 unlock="http://www.example.com/info.html#chapter2"
 price="US$ 0.03" duration="10">Open Chapter 2</a>

Open in the beginning

Open in Chapter 1

Open in Chapter 2

How unlock affects paid-links

When a link is paid for a certain amount of time (see the duration attribute), say 10 minutes, it displays the text "you have access" when the mouse hovers over it during this time.

In addition, the link displays a timer that keeps track of the time that the user still has to access the link. This timer counts down to zero, at which point it displays the price of the link again.

However, not only the link that was paid, but all the links whose unlock is the same, are unlocked and identified with the "you have access" text upon unlock of the purchased link. This also applies if you use the appendable attribute, in which case the unlock will begin the same.

Here is why: If you have more than one paid-link with the same unlock command, this means that all links unlock the same content when paid. However, it does not make sense for the user to pay for more than one of these links, as he or she will be paying for the same content more than once. All links that point to already unlocked content must be displayed as unlocked.

In other words, iCents.net does not check the href attribute to determine whether a link is paid and unlocked or not; it only checks the unlock attribute. It is responsibility of the website to guarantee that the unlock attributes correspond to the href attributes, as necessary.

Bearing the above in mind, you will find below the right and the wrong way of combining the href and unlock attributes in a set of paid-links.

The correct way to combine href and unlock attributes

A website often has more than one link pointing to the same content. In the example below, we have 3 links that point to the same content using the href attribute. The unlock attribute for all 3 links must also be the same, so that the purchase of any one of them sets all of them as unlocked. Note that the price and duration of all 3 links is also the same and you must not sell the same content at different prices and under different conditions according to the link used.

paid-link

paid-link

paid-link

 

In the following example, we have 3 links pointing to different content, but you want all of them to be unlocked when any one of them is bought. You can do this by selling a micro-subscription using the appendable attribute. In this example, the href attribute is different for each one of the 3 links, but the unlock attribute is the same: unlock="http://www.icents.net/en/developer/attributes/test2" with appendable="true".

paid-link 1

paid-link 2

paid-link 3

The wrong way of combining href and unlock attributes

In the example below, we have 3 links that point to different content using the href attribute. However, the unlock attribute for all 3 links is the same, i.e. unlock="http://www.icents.net/en/developer/attributes/test3A.html". This is why the purchase of any link will set all of them as unlocked.

But this procedure only works if the Access Filter is not controlling access to the content. In reality, the Access Filter Software will have control and will only unlock access to the content of the first link, which is located at http://www.icents.net/en/developer/attributes/test1.html.

In this case, the second and third links will not work at all. Note that the correct way of selling several content items through the purchase of a single paid-link is using micro-subscriptions via the appendable attribute.

paid-link with different href and same unlock

paid-link with different href and same unlock

paid-link with different href and same unlock

 

In the following example, the problem is the opposite of the example shown above. Now, the href attribute is the same for the 3 links, but the unlock attribute is different for each one. This is why the example allows you to purchase each one of the links regardless of whether all of them point to the same content. You must never cause the user to pay for content that has already been paid and unlocked; therefore, this code is wrong.

paid-link with same href and different unlock

paid-link with same href and different unlock

paid-link with same href and different unlock

Future functionalities of the unlock attribute

The unlock attribute may represent the name of the content to be unlocked

At the moment, it is not yet possible to control access to content through its name, only through its URL. However, access control through names is an advanced functionality planned for the next version of the Access Filter software. It works as follows:

If the unlock attribute does not begin with http://, https:// or ftp://, then it will be considered to be the name of the piece of content, not its URL. For example:

<a href="http://www.example.com/image.gif"
 unlock="teste"
 price="US$ 0.1">paid-link</a>

In this example we have unlock="test", where "test" is not a URL; therefore, it can be considered as the name of a certain content item.

The name of the unlocked content items could be checked with ASP, ASP.NET and PHP on the website server.

Note that although it is still not possible to control access using names in the Access Filter software, it is possible already to use names in paid-links for browser testing purposes, without server access control.

Interaction with Other Paid-Link Attributes

Interaction of the unlock and icents Attributes

When the paid-link price is zero (i.e. when you have a free paid-link), the link cannot have the unlock attribute, otherwise the link will show an error.

Interaction of the unlock and appendable Attributes

The appendable attribute defines whether the unlock attribute can be "completed" with more text. In other words:

For more information, please refer to the explanation of the appendable attribute.

Troubleshooting