ANy Idea? from where these file came, native.history.js and find.js

Vote:
 

Hi,

with my bundled files these are extra files I can spot in my HTML.

Any idea what are these files and how these lines are generating?

Regards

Khurram

#113004
Nov 10, 2014 13:59
Vote:
 

As far as I know, they are coming from EPiServer Find, and are being put there as required client resources. They are used for the tracking functionality in Find.

#113009
Edited, Nov 10, 2014 14:50
Vote:
 

Per Magne is correct they are inserted on the page if tracking is enabled in Find to be able to track clicks in the search results.

/Marcus

#113011
Nov 10, 2014 15:13
Vote:
 

Is is possible to gzip and compress the files from EPiServer? I would also like to be able to add asyc or defer to them as I am able with other externl scripts.

#116832
Feb 05, 2015 14:35
Vote:
 

Bump!

What Eric says...
Google considers these 2 scripts to be render-blocking, which decreases performance and may ultimately lead to worse ranking within Googles search results.
(Googles documentation: https://developers.google.com/speed/docs/insights/BlockingJS)

Cheers 
Reinder

#155071
Sep 08, 2016 15:08
Vote:
 
#155163
Sep 09, 2016 17:03
Vote:
 

Thanks David,

I believe I've seen that page before, however it does not provide a way to specify attributes like 'async' or 'defer'. 
And Eric is in the comments there as well, asking the same thing as he does above :)

#155194
Sep 12, 2016 9:16
Vote:
 

Hello Reinder

If you really want to customise how the scripts are rendered then you can create a custom version of the RequiredClientResources method found in EPiServer.Framework.Web.Mvc.Html.ClientResourceExtensions. This ultimately calls the Render method of EPiServer.Framework.Web.Resources.ClientResources which you will also need to provide a customised implementation to add the async attribute.

However it should be noted that it looks like the Find external scripts need to be loaded before the inline Find configuration script so if you go down this approach you should be careful about the order the JS is loaded. So if you ended up with the example below Find may not be configured correctly:

<script type="text/javascript" src="https://dl.episerver.net/12.2.0/epi-util/native.history.js" aysnc></script>
<script type="text/javascript" src="https://dl.episerver.net/12.2.0/epi-util/find.js" aysnc></script>
<!-- Script below may needs to be executed after the above scripts have loaded async --> 
<script type="text/javascript">
if(FindApi){var api = new FindApi();api.setApplicationUrl('/');api.setServiceApiBaseUrl('/find_v2/');api.processEventFromCurrentUri();api.bindWindowEvents();api.bindAClickEvent();api.sendBufferedEvents();}
</script>

David

#155201
Sep 12, 2016 10:48
Vote:
 

Thanks David, I'm gonna look into this.

And good point about the order!

#155248
Sep 13, 2016 10:00
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.