question

johnjohn-0472 avatar image
0 Votes"
johnjohn-0472 asked ·

Add a custom CSS/Javascript to the site's home modern page

i am working on a modern team site >> and for the home page ONLY, i want to hide the Site navigation bar, left-hand side navigation, page title and modify the float to remove the white space on the left-hand side + add a JavaScript to reload the page each 5 minutes.

to achieve the above i added the sharepoint modern script web part @ https://github.com/pnp/sp-dev-fx-webparts/tree/master/samples/react-script-editor and i added this custom css + custom javascript:-


75986-custom.png


and it achieved what i am looking for.. but based on my reading that my above approach of adding modern script editor web part and inside it to add custom CSS/JavaScript is not supported.. so my question is how i can apply the above custom CSS/JavaScript in a supported way inside the home page? thanks in advance for any help.

Regards


office-sharepoint-online
custom.png (22.4 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AmosWu-MSFT avatar image
0 Votes"
AmosWu-MSFT answered ·

Not all customizations are allowed on the modern team site. You can refer to this document:What's not supported on "modern" team sites


If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 4 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AmosWu-MSFT yes i know, but in my case i need to do the following:-

1) Add custom CSS.

2) add a simple javascript to reload the page

3) i need to force the above 2 point to run on the home page only.. so is this possible using a supported way?

Thanks

0 Votes 0 ·

As I test, you could use SPFX to inject js to the home page to reload the page. But not all custom CSS can affect the page style.

0 Votes 0 ·

Do you have any update on this issue?
You can accept the helpful post as the answer to help other community members find helpful information quickly.

0 Votes 0 ·

I am checking to see how things are going there on this issue. Please let us know if you would like further assistance.
You can accept the helpful post as the answer to help other community members find helpful information quickly.

0 Votes 0 ·