CreateObjectURL and RevokeObjectURL (Explained by Example)

preview_player
Показать описание


In this video we will learn how to use CreateObjectURL and RevokeObjectURL to cache resources locally after loading them with the fetch url and using them locally, then finally releasing them after we are done by calling revoke.

As usual we will use Javascript since this code runs in the browser and we will load an image over the air using fetch api then we will cache the image locally using CreateObjectURL then set this image as resource. Finally, we will revoke the resource.

Stay Awesome!
Hussein
Рекомендации по теме
Комментарии
Автор

I just discovered your channel and i already love it, your way of teaching is superb, despite i am not a native american speaker i understand every thing. thx!

Fernando_SC
Автор

in eventlistener you could revoke the url first then blob another one to avoid memory leak. otherwise with each click the browser creates a new url which points to a new memory address even though the url variable changes to new one but the garbage collector wont delete it

EhSUN
Автор

Expiation with *examples* is a game changer

joshuabharathi
Автор

Nice explanation. Finally, understand what it is after watching this

AnatolyLeonov
Автор

You Rock my man, , , You litterally Burnt it, :v i need to learn a whole bunch. You inspire me

programmerarnab
Автор

You are my hero. This video saves my project.

bachnghianguyen
Автор

u could get all imgs by querySelectorAll

alex-bcsi
Автор

Yeah that was great but what If I want to load image videos from server.Should I need to create blob out of url in client side or serverside and then send that to client

jivanmainali
Автор

almost all stackoverflow threads are old and wants you to use the FileReader api but this is much simpler

soniablanche
Автор

Any reason why revokeObjectURL doesn't do anything in Firefox? At least that's my situation

yekna
Автор

Here is a scenario. I want only the authorized user should be able to view the content(video). Can I pass the JWT token as a bearer header with fetch and get the link for the the authorized video. ...then following the same step above ??

kartikeyaagrawal
Автор

how can i do it, but with videos?? and not images?

boryziin
Автор

Do it with video tag please, how to RevokeObjectURL a video url ?

HoaiLe-tyui
join shbcf.ru