0

I have two seperate css stylesheet files (Style1 and Style2) for my google web application. I am storing one of these file name in browser storage as:

  localStorage.theme 

I am applying the default Style1 to my html using:

<head>
<base target="_top">

   <?= HtmlService.createHtmlOutputFromFile('Style1') ?>

</head>

I have two questions:

  1. Is it possible that, when the page loads it reads the browser storage and apply the stylesheet specified there?

  2. Is it possible to toggle stylesheets on the fly without reloading the application?

Partha S. Pal
  • 169
  • 1
  • 2
  • 14
  • 2) is possible using JavaScript. Load the required file using AJAX and put its contents in a – Mr Lister Jun 09 '19 at 07:02
  • See post: [change-the-content-of-a-style-element-through-javascript](https://stackoverflow.com/questions/2698208/change-the-content-of-a-style-element-through-javascript) If the layout of elements needs to be changed, then a reflow needs to be forced. If the new CSS doesn't change the layout of elements, then a repaint is needed. [Github - What forces reflow](https://gist.github.com/paulirish/5d52fb081b3570c81e3a) [StackOverflow - force-webkit-to-redraw-repaint](https://stackoverflow.com/questions/3485365/how-can-i-force-webkit-to-redraw-repaint-to-propagate-style-changes/3485654#3485654) – Alan Wells Jun 09 '19 at 14:31

0 Answers0