[Fixed]-Djangobyexample book – jquery bookmarklet not working at all

1👍

Your include tag is split over two lines:

images from other websites → <a href="javascript:{% include
"bookmarklet_launcher.js" %}" class="button">Bookmark it</a><p>

Django does not support multiple line tags. Change it to:

images from other websites → <a href="javascript:{% include "bookmarklet_launcher.js" %}" class="button">Bookmark it</a><p>

0👍

I have faced the similar error while going through the book.

The bookmark button is not functioning,when i debugged it through chrome debugger,i could able to see errors at js level.I have made two changes to resolve these errors.

1.Error message: net::ERR_ABORTED

Action step:
In the book its mentioned that to place bookmarklet.js in images application directory,but in bookmarklet_launcher.js the source is refered to below path

http://127.0.0.1:8000/static/js/bookmarklet.js?r=

So place bookmarklet.js in /static/js/ directory inside images application(if folder structure not available create it).

2.Error message: net::ERR_ABORTED

There is one more file that should be placed which is bookmarklet.css which is being refereed at below line in bookmarklet.js.

href: static_url + 'css/bookmarklet.css?r=' + Math.floor(Math.random()*99999999999999999999)

Action step:

create a file bookmarklet.css inside /static/css/ directory and place the css code.Refer below link for css code:

Git Hub link for css code reference

1.After the above steps,restart the development server.

2.Drag the bookmark it button to create a bookmark in browser.

3.Open any website that is HTTP(not https) and click on bookmark it(The one which is bookmarked in browser not bookmark it button).

enter image description here

4.The below pop up appears

enter image description here

0👍

the problem is that template doesn’t exist so try t do the following
**
1. make sure your include code in same line
2. make sure same name of the template exist on your project director /images/templates/file_name.js.
3. or go to setting and add your templates directory to templates.
4. if it load but no images views don’t forget that you only accept jpeg and jpg images only
** so you can try another sites like wikipedia **

0👍

I was able to solve this by making sure that the url from ngrok tunnel in the bookmarklet.js and bookmarklet_luncher.js starts with https not http

Instead of this http://127.0.0.1:8000/static/js/bookmarklet.js?r= it should rather be

https://127.0.0.1:8000/static/js/bookmarklet.js?r=

0👍

After 4 hours of doing everything… googling, deleting code, and rewriting code…

Only had to hit Ctrl+C to stop server and re-run server .

Just take a break and come back to fix it 🙂

Mine works same as instructed in the book – no changes, no nothing.

Only restarted the server.

Leave a comment