In SharePoint 2013 is enriched with the Script Editor web part. The web part makes it very easy to add JavaScripts and Jquery script to your SharePoint 2013 site.
Solution
1. Edit the page where you want to use JavaScript.
2. Add the web part Script Editor.
3. Edit the web part Script Editor.
4. Insert the needed Javascript, in this example the JavaScript will show the current date and time.
5. Save the changes and enjoy the result.
Result
The script doesn’t work when I go to /subsite/_layouts/15/start.aspx#/
@Jimmy can you tell me more about your issue? I am unable to understand what you mean.
The script works fine when I hit the page using http://sharepoint/SitePages/Home.aspx.
But when I hit the page using http://sharepoint, it will be redirected to http://sharepoint/_layouts/15/start.aspx#/SitePages/Home.aspx, and the script in the Script Editor Web Part is totally disappeared.
FYI, I am using a Team Site.
Thanks for your reply.
When I use the URL https://Sharepoint/_layouts/15/start.aspx#/SitePages/Home.aspx or https://Sharepoint/ SharePoint automatically redirects me to https://Sharepoint/SitePages/Home.aspx. The javascript on this page will still show the correct information.
I am also using a team site. Maybe you can try and make a new team site to see if that fixes the problem.
@Ben: /_layouts/15/start.aspx# is the minimal download strategy. It seems that this feature is deactivated on the site you are testing, that’s why you are redirected to /SitePages/Home.aspx.
I tried to create a new site collection using Team Site template, the behavior is still same. I think is the SharePoint version. Thanks for your reply anyway.
I had not noticed this web part in the Media and Content Category. Looks like an improvement over the content editor web part for inline javascript editing.
I actually figured this out on my own–but not before I did a major search for SharePoint Content Web Editor. Only to find out it was just a Rich Text Editor and not a script editor. I love columns like yours–which is why I also write.
http://blog.sonisick.com
thanks,
Stephan