This question has been posted before but I did not see anything in those posted solutions doing something about the standalone ASPX pages which can be created through SharePoint Designer

The thing about the standalone ASPX pages is that they are not connected to any SharePoint master page so is there any way to make the JavaScript appear in these standalone pages?

Instead of regular pages which will have something like this in the page directive right at the top
<%@ Page language="C#" MasterPageFile="~masterurl/default.master" %> in standalone pages you will see the MasterPageFile attribute will be missing

Reference Links-

Add Javascript to every page in Sharepoint 2013

How to not use SharePoint master page

I am interested in solutions that work for SharePoint 2013

1 Answer 1


You can create a new Ribbon Element to display in case of Page. And add the JavaScript as part of the Element.

This way it gets loaded for all Pages.

  • that's interesting,, are you saying we create a new ribbon element for all the pages OR a new ribbon element which would display just for standalone pages ? If its the latter how would the ribbon element know that the page is a standalone page ? this sounds like a workable solution. I will do some more checking on my end on the feasibility of this before I mark it as the answer, thank you .
    – vivek m
    Commented Sep 2, 2016 at 19:58
  • The ribbon is common for all pages.. I thought you want it for all pages? Application pages you can find it by checking the URL which will have _layout in it Commented Sep 2, 2016 at 20:12
  • Yes I do want it for all pages. The scenario is - there is a hyperlink on a regular SharePoint page and the hyperlink points to the standalone ASPX page which opens in a dialog window when somebody clicks the hyperlink. I am not sure if adding the element to the ribbon will have any effect on pages which are opened in a dialog window. Your solution will work for all pages which are opened directly by browsing to that page URL but will it work for something like the above?
    – vivek m
    Commented Sep 2, 2016 at 21:17
  • Hey Amal, the ribbon code is part of the masterpage (if you open the masterpage in text code you will see what I mean) . If the standalone pages do not have any reference to any masterpage how will the ribbon show when you browse to a standalone page? I don't think your solution is going to work
    – vivek m
    Commented Sep 6, 2016 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.