Try our conversational search powered by Generative AI!

EPi.SetupPropertyObjects = function()

Vote:
 
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
Vote:
 
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
Vote:
 
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
Vote:
 
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
Vote:
 
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
Vote:
 
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
Vote:
 
Hi!
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...

/Henrik
Co-inventor of EPiServerScriptManager.js...

 

#25277
Oct 16, 2008 22:37
Vote:
 

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">
//<![CDATA[
EPi.SetupPropertyObjects = function()
{
 EPi.RegisterPropertyObject(window, "EPiObject", {EPiOnPageEditControl:"OnPageEditControl"});
}
//]]>
</script>

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?

//Stefan

#25324
Oct 20, 2008 16:10
Vote:
 

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.

/Regards
Henrik

#25327
Oct 20, 2008 17:55
Vote:
 

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.

/Regards
Henrik

 

#25343
Edited, Oct 21, 2008 20:14
Vote:
 
Just want to add that i have the same problem. And i use Episerver 5 R2
#25898
Edited, Nov 11, 2008 13:50
Vote:
 

I am facing the same problem.I am using Episerver 5 R2 .but in my case

all the javascript is been referred in html source rendered.

 <script src="/MyEPiServer/util/javascript/episerverscriptmanager.js" type="text/javascript"></script>
<script src="/MyEPiServer/util/javascript/onpageedit.js" type="text/javascript"></script>
<script src="/MyEPiServer/util/javascript/contextmenu.js" type="text/javascript"></script>

BUt still I am getting error "EPi is not defined" .

Note: In my case no error working with .Visual Studio.error comes only when deployed in IIS.

#29636
May 07, 2009 12:52
Vote:
 

Dear Steven Stieng ,

can you pls explain  " 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 Not what I wanted, but it works "

#29642
May 07, 2009 13:48
Vote:
 
I have this problem with a 5.1.422.267 site. The script IS referenced in the page, however if I point the browser to the actual js-file (http://mysite/Util/javascript/episerverscriptmanager.js). I get a 403.1 error and it seems IIS is trying to run the js-file server side or something. How come? The whole site was setup using Episerver Manager...
#29998
May 26, 2009 17:02
Vote:
 

Hi,

Any news on this? I have done a fresh install of relate+ on my local box and I am getting this error when first viewing the site.

Thanks a lot

#30804
Jun 22, 2009 18:13
Vote:
 

Anyone solved this?

#34772
Nov 15, 2009 0:10
Vote:
 

Oh the irony. This page has a javascript error. Guess wich one :)

#35961
Jan 08, 2010 14:09
Vote:
 

I have discovered that this is due to an url with small/capital letters. (I know you don't beleive me ;-)

In my installation the Util url is /Util and the call is /util and it's causing this error. When I correct it in the web.config with just small letters the epi-object is defined.

Check your spelling in web.config regarding the util-path!

#35962
Jan 08, 2010 14:25
Vote:
 

I also had a fresh install of Relate+ on my local box and was having the same error.

The fix above solved the problem. Thanks.

#36284
Edited, Jan 22, 2010 14:03
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.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.