Answered by:

how to implement ads removal button in my html/JS app ?

Question

i had a game app built using html5/JS , now i had integrated ads in it, i also want to implement an "ad removal" button so that when user don't want ads & clicks on the button then the app must prompt user to pay ***$ to remove ads, how can
i implement this, please provide example code with detailed explanation.

For the technical party, you can simply use document.getElementById() to target your ad control and remove it from your page, that's easy.

--James

<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support

Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

Use following code to detect if your client has purchased the feature.

licenseInformation.productLicenses.lookup("featureName").isActive

--James

<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support

Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

Besides, your code snippet looks correct, but I don't know the other parts, I would suggest you follow the sample to see if it can help you.

Note When using the simulation, the initial licensing state of the app is described in WindowsStoreProxy.xml.
CurrentAppSimulator method that alter the license state, for example by buying a license or handling an in-app purchase, only update the license state of the object in memory. The contents of WindowsStoreProxy.xml are not changed. When the
app starts again, the license state reverts to what is described in WindowsStoreProxy.xml.

Can you double check if you have this file exist or did you load the license information before you using the CurrentAppSimulator?

--James

<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support

Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

Yes, of course, for Windows 8 app samples, download the
Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

--James

<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support

Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

For the technical party, you can simply use document.getElementById() to target your ad control and remove it from your page, that's easy.

--James

<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support

Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

Use following code to detect if your client has purchased the feature.

licenseInformation.productLicenses.lookup("featureName").isActive

--James

<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support

Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

Besides, your code snippet looks correct, but I don't know the other parts, I would suggest you follow the sample to see if it can help you.

Note When using the simulation, the initial licensing state of the app is described in WindowsStoreProxy.xml.
CurrentAppSimulator method that alter the license state, for example by buying a license or handling an in-app purchase, only update the license state of the object in memory. The contents of WindowsStoreProxy.xml are not changed. When the
app starts again, the license state reverts to what is described in WindowsStoreProxy.xml.

Can you double check if you have this file exist or did you load the license information before you using the CurrentAppSimulator?

--James

<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support

Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

Yes, of course, for Windows 8 app samples, download the
Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.

--James

<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support

Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.