Forum Discussion
Weird behavior for adding "embed code" inside our classic pages and inside application pages
I am working on a new sharepoint tenant. and using the sharepoint/tenant admin i created a new Communication modern site. and i have migrated our on-premises 2013 classic team site into the new communication site, i did the migration using a third part tool named share-gate. but i got weird behavioure for the "Embed code" web part, as follow:-
1. inside the sharepoint online admin center site >> setting >> we have custom script disabled, as follow:-
2. then inside the migrated site (which is a modern communication site), i am able to add "embed code" inside existing and new classic site pages as follow:-
2. while if i edit an application page such as "lists/discussion/allitems.aspx", and i edit the page i can not add "embed code" or "script editor" web parts:-
so i have the following question based on my above points:-
1. since we have "custom scripts" disabled inside the sharepoint admin center >> settings. then how i were able to add "embed code" web part inside my site pages?
2. why i am able to add "embed code" inside site pages, while i can not do so inside application pages?
3. if we have "custom scripts" disabled inside the sharepoint admin center >> settings. then will customs scripts be enabled or disabled inside communication sites created by sharepoint admin?
15 Replies
- AnonymousHave you actually tried to insert script into the page? I remember my Sharepoint site would have this option available, but soon as I added the script tag to the box and hit Ok it would prompt me to a warning telling me I couldn't.
- john johnIron Contributor
Deleted wrote:
Have you actually tried to insert script into the page? I remember my Sharepoint site would have this option available, but soon as I added the script tag to the box and hit Ok it would prompt me to a warning telling me I couldn't.Deleted
thanks a lot for the advice. now i created a classic page >> add "Embed code" , i got this 2 results:-
1. Inside the embed code i added pure HTML element, as follow:-
<h1 unselectable="on">test</h1>
and i were able to save the page without any issue.
2. While if i try to add a script element inside the "Embed code" as follow:-
<h1 unselectable="on">test</h1>
<script>
alert("123");
</script>i got this error:-
This HTML cannot be inserted because you don't have access to add scriptable Web Parts in this site. Please contact your administrator if you think you should have rights to do so.
so can i conclude that in my case i can add "embed code" web parts, but those "embed code" need to contain HTML only?
second question, so seem i do not have "custom scripts" enabled inside our communication site (since i was not able to add <script> tags inside the "embed code"). so can i enable the custom scripts for this communication site only, without having to affect the "custom scripts" settings inside other sites, or change the settings inside the sharepoint admin center site?
- Anonymous
so can i conclude that in my case i can add "embed code" web parts, but those "embed code" need to contain HTML only?
It cannot contain script, hence you will be not able to use the script tag in that code. I think you can still use other tags, such as the link tag to include CSS.
second question, so seem i do not have "custom scripts" enabled inside our communication site (since i was not able to add <script> tags inside the "embed code"). so can i enable the custom scripts for this communication site only, without having to affect the "custom scripts" settings inside other sites, or change the settings inside the sharepoint admin center site?
Yes, you can enable custom script for that site alone. But first, you need to allow users to runcustom script. Only then, you will be able to turn on custom scripting on your site. For more information, you can check http://sharepoint.handsontek.net/2018/10/28/enable-custom-script-on-modern-sharepoint-sites-using-powershell/
Regards
- Eva VogelIron Contributor
Hi john john!
i suggest you should ask someone at the helpdesk of share-gate.com, Mia Lohé Chung wrote here couple of articles about the migration tool, she works there.
Look at this: https://techcommunity.microsoft.com/t5/SharePoint/Migrate-Libraries-using-ShareGate-s-Copy-Site-Object-misses/td-p/117310
I am not familar with that tool. Pose your question directly to her pls.
Greets, Eva.
- john johnIron Contributor
Eva Vogel wrote:Hi john john!
i suggest you should ask someone at the helpdesk of share-gate.com, Mia Lohé Chung wrote here couple of articles about the migration tool, she works there.
Look at this: https://techcommunity.microsoft.com/t5/SharePoint/Migrate-Libraries-using-ShareGate-s-Copy-Site-Object-misses/td-p/117310
I am not familar with that tool. Pose your question directly to her pls.
Greets, Eva.
but i do not think this problem is related to the migration tool, it is related to sharepoint communication site...