EPi.SetupPropertyObjects = function()

We are developing our first site using EPiServer 5.0. It seems like EPi CMS is generating faulty javascript code at the bottom of the HTML output. The javascript error message is: Line 390 Char 1 Error: 'EPi' is undefined Code: 0 URL: http://localhost/en/.... -> {rest of the url} Anyone else got this problem?
#15884 Nov 21, 2007 15:12
  • Member since: 2002
    Hi Steven! This has to do with the right click menu. You should have a couple of javascript files registered for your page. These should include: "/util/javascript/episerverscriptmanager.js" "/util/javascript/onpageedit.js" "/util/javascript/contextmenu.js" Can you see if these files are referenced from the html?
    #16564 Nov 21, 2007 17:48
    By viewing the source, I can see that episerverscriptmanager.js is included. But onpageedit.js and contextmenu.js is not included.
    #16565 Nov 22, 2007 11:21
    After some seriouse e-mailing with EPiServer, we found the solution. I had put all content of the tag in a user controll. So in the masterpage it looked like this: In my usercontroll, I have put the tag This unfortunately causes EPiServer to output and empty tag because it does not find it in the MasterPage. To avoid doubble output of the <title> tag, I had to move the <title> tag out of the usercontroll, and in to the master page. <code> <head> <title> Company name Not what I wanted, but it works :)
    #16566 Dec 11, 2007 12:31
  • Member since: 2006
    How is that related to the EPi.RegisterPropertyObject issue? Anyways, we're experiencing the same thing - the episerverscriptmanager.js file is linked for some reason.
    #16567 Mar 13, 2008 17:32
    Did you find any solution to this issue? We're also experiencing the same thing. The EPi.SetupPropertyObjects-issue that is.
    #25264 Oct 16, 2008 17:05
    The EPiServerScriptManager.js is heavily used in edit/admin mode but is generally not needed in template pages unless the user is logged in and right click menu is enabled, where it should be automatically included. If a template page contains EPiServer controls usually used in edit mode (for example editor, date selector etc) the EPiServerScriptManager.js is required for some of them to work and will (should, see below) be registered along with script functions like EPi.SetupPropertyObjects and EPi.SetupEvents in the bottom of the page.

    The EPi js object is used to encapsulate a lot of EPiServer related javascript functions (to easier avoid conflicts with your own and others javascript) and is instantiated in EPiServerScriptManager.js.
    The script function EPi.SetupPropertyObjects registered on the page (in this case by right click menu) won't work without the EPiServerScriptManager.js first instantiating the EPi object. The SetupPropertyObjects function is called from within the EPiServerScriptManager.js on window load so they are intimately related.

    However, the right click menu should also register the EPiServerScriptManager.js. We have had issues in earlier versions of CMS 5 where the registering of required javascript files did not occur in some scenarios and to overcome this you had to include the EPiServerScriptManager.js (and/or other js files) yourself, like Linus suggests above. But I don't recall right click menu to be one of those issues.

    Hopefully I have managed to explain a little what is going on and how things relate to each other.

    @Ted For above reasons there is no easy answer to why you unwillingly have the EPiServerScriptManager.js included to your pages and I really don't know how to help you. Do you get the EPi.SetupPropertyObjects or EPi.SetupEvents function(s) registered in the bottom of the page? If you do I would love to see what they say...

    Co-inventor of EPiServerScriptManager.js...


    #25277 Oct 16, 2008 22:37

    Hi Henrik,
    We are getting this EPiServer-script on all of our pages for no obvious reason. The user is not even logged in and still it shows up.

    <script type="text/javascript">
    EPi.SetupPropertyObjects = function()
     EPi.RegisterPropertyObject(window, "EPiObject", {EPiOnPageEditControl:"OnPageEditControl"});

    It seems to cause the following javascript error for people on the internet surfing to the site: "Fel: 'EPi' är odefinierad". A strange thing is that the error-message doesn't show up for people at work.  

    Can you, from this information, tell us what could be wrong?


    #25324 Oct 20, 2008 16:10

    Hi Stefan (and everybody else)!

    I want to investigate it a little further (when at work) but it's definetely related to On Page Edit, aka OPE, former known as DOPE Laughing, but as you state there is no reason why it tries to register this when users not logged in are accessing the site. Which version of CMS are you using?

    A quick fix to avoid the javascript error is to include the /Util/Javascript/EPiServerScriptManager.js to your pages but that's not really the solution since you don't have any use for it (well you possibly could but let's not get into that). 

    But I really have to look up what's going on with OnPageEditControl before I can come with a possible solution/answer.


    #25327 Oct 20, 2008 17:55

    Hi again,
    I have done some investigations and my conclusion is that this behavior is considered to be a bug and I have reported it.
    There is, to my knowledge, no easy way to avoid the script from being registered unless you stop using the context menu (right click menu) on your template pages (for editors/admins). I however haven't tested this but since the bug is related to the context menu I think this will prevent the script from being added.

    If you still want the context menu to be available for logged in users, there are two ways to avoid the script error with "EPi is not defined". One way is to make sure the EPiServerScriptManager.js is registered on the page as I suggested in previous post. The other way is to include below js code in some other js file you make use of in your pages or by adding the script directly to your pages but before the EPi.SetupPropertyObjects code.

    if (typeof(EPi) == "undefined") {
         var EPi = {};

    That is about all I can suggest at the moment. I really can't say why this behavior haven't been discovered earlier or when a fix will be available.



    #25343 Edited, Oct 21, 2008 20:14
  • Member since: 2006
    Just want to add that i have the same problem. And i use Episerver 5 R2
    #25898 Edited, Nov 11, 2008 13:50
First   1 2   Last 
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
Please login to post a reply