Can we have conditional tags or data in html/javascript based on user details? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we have conditional tags or data in html/javascript based on user details?

I need to generate html email text where some data/tags are to be conditional based on email recipient e.g. user A will see para1 and user B will be para2. Is it possible? How can I check in html/ javascript who is the recipient?

17th Jun 2017, 10:29 AM
Gurpreet Singh
Gurpreet Singh - avatar
4 Answers
+ 3
Nope, as far as I know it isn't possible. For that JavaScript or Php must be embedded in it with their respective tags. Also, 'cause HTML is a basic and core language and It doesn't supports that.
17th Jun 2017, 9:33 PM
Ibrahim
Ibrahim - avatar
+ 2
Look, I haven't learnt JavaScript in depth, but I know that JavaScript can be embedded in HTML via <script> tags. And when it comes to php, it is embedded using <?php ?> tag. For more detailed info, I seriously recommend you doin' course from w3schools.com 'cause that's the place where I got the concept of embedding and stuff. And yeah, its totally free
17th Jun 2017, 9:47 PM
Ibrahim
Ibrahim - avatar
0
many thanks for the idea buddy. I have done Javascript course in SL so aware of the basics. will see if there is any function to get user details
17th Jun 2017, 9:50 PM
Gurpreet Singh
Gurpreet Singh - avatar
- 1
Thanks, can you please throw more light or explain with a snippet on how to embed javascript for this purpose.
17th Jun 2017, 9:43 PM
Gurpreet Singh
Gurpreet Singh - avatar