Sunday 31 May 2020

How to read a HTTP only cookie using JavaScript

Hello Friends,


In this article, I will explain how to read an HTTP only cookie using JavaScript

In the last week, I was working with one issue where we need to access HTTP only cookie using JavaScript. 




So the answer is No We can not access HTTP only cookies using javascript. HttpOnly cookie is that it's not accessible to client-side scripting,


What I did find on a website was:

"The big security hole, as alluded to above, is that Firefox (and presumably Opera) allow access to the headers through XMLHttpObject. So you could make a trivial JavaScript call back to the local server, get the headers out of the string, and then post that back to an external domain. Not as easy as document.cookie, but hardly a feat of software engineering.


 You could set a hidden variable or inline code with the cookie value when the server processes it



Don’t forget to leave your feedback and comments below!
If you have any query mail me to Sujeet.bhujbal@gmail.com     
Happy programming!!
Don’t forget to leave your feedback and comments below!
Regards
Sujeet Bhujbal
--------------------------------------------------------------------------------
------------------------------------------------------------------------------

Wednesday 20 May 2020

Angular - CSS style not applying on angular directive

Hello Friends,


In this article, I will explain how to solve CSS style not applying on the angular directive 

In the last week, I was working with one directive where  CSS style was not applying on the angular directive 





Solution 1. Please add /deep/ to your CSS class 

Solution 2 We should use::ng-deep instead of /deep/ which seems to be deprecated.

Usually /deep/ “shadow-piercing” combinator can be used to force a style down to child components. We have another option called::ng-deep.

since /deep/ combinator has been deprecated, it is recommended to use::ng-deep

Please find the below example. This class will be applied to child component


Example
.overview {
    ::ng-deep {
        p {
            &:last-child {
                margin-bottom: 0;
            }
        }
    }
}

Hope this helped you to solve your error
Happy Programming!!
Don’t forget to leave your feedback and comments below!
If you have any query mail me to Sujeet.bhujbal@gmail.com     
Happy programming!!
Don’t forget to leave your feedback and comments below!
Regards
Sujeet Bhujbal
--------------------------------------------------------------------------------
------------------------------------------------------------------------------