Akxe
Akxe

Reputation: 11555

Keep, but deactivate stylesheets & scripts

I have 4 pages, I use ajax and historyPopState to change betweens them. But there is a problem since the pages are very different they use different stylesheets and scripts. I could just download them over and over again, but I wanted to ask if there is a way how to keep it onpage, but only disabling it for a moment and reenable them when needed.
PS.:Those 4 pages have one stylesheet & one script in common.
PPS.: And I can't set headers (not access to all things in server)

Upvotes: 2

Views: 69

Answers (1)

Brin Marx
Brin Marx

Reputation: 153

In javascript you can disable stylesheets by accessing the styleSheets object on the document and setting disabled to true: (tested in Chrome and IE9. I couldn't find any useful statistics on compatibility for this)

document.styleSheets[0].disabled = true

Upvotes: 3

Related Questions