Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anyway to change <html> tag's attributes during run time?

I want to add the manifest attribute during run-time, so the I can control when the Appcache will be downloaded.

Ex: When a user is logged into the application properly,

<html>
// page content
</html>

changes into:

<html manifest="myapp.manifest">
// page content
</html>

Is there anyway I can achieve this using javascript, jquery or anything? What I want to is to control when the Appcache will be downloaded conditionally.(I have already read about having another html inside an iFrame.)

like image 657
JRulz Avatar asked Dec 06 '22 02:12

JRulz


1 Answers

According to the specification, changing the manifest attribute after the document loaded has no effect.

You can still access the html element and change the attribute value, via document.documentElement:

document.documentElement.setAttribute('manifest', 'myapp.manifest');

It just won't do anything.

like image 171
Felix Kling Avatar answered Jan 05 '23 06:01

Felix Kling