Question

I'm integrating a button that will launch the Evernote Bookmarklet in my project. The code for the bookmarklet is:

javascript:(function() {
       EN_CLIP_HOST='http://www.evernote.com';
               try{
                    var x=document.createElement('SCRIPT');
                    x.type='text/javascript';
                    x.src=EN_CLIP_HOST+'/public/bookmarkClipper.js?'+ (new Date().getTime()/100000);                                                                                                
                    document.getElementsByTagName('head')[0].appendChild(x);
                }catch(e) {     
                    location.href=EN_CLIP_HOST+'/clip.action?url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title);
                }
            })();

The code is called with an onClick event on a HTML link. My problem is what is the best way to strip off the styling for when the Evernote clips it and saves it? So that it readable?

Was it helpful?

Solution

Stripping the styling is never safe and never will be. If Evernote changes its response, your code will probably break.

You should take a look at their API instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top