WebSite X5Help Center

 
A A.
A A.
User

Best place for java script  en

Автор: A A.
Просмотрено 3552, Подписчики 1, Размещенный 47  
Тэги: javascript

I have the javascript that I called from several webpages. What is the best place to put the javascript to? If I put it separately on every page that uses it [in html/javascript box], it is a hassle to maintain it (I already made a mistake changing script on several pages and leaving it that change from one of the pages). If i put it in General Setting->Expert->Header it slow downs website and add that script to the pages that do not call it? What is the best practice?

Размещено
3 Ответы - 1 Корректно
Cheeky Man
Cheeky Man
User

Wink

If you can insert the script in it's own format (JavaScript) and put it on the server seperately. Then link the script to the code in the head...... Sometimes they give you an option to do this. Without seeing the script or what is I couldn't say....

.

Frank

.

Incomedia opens on Monday....

Читать больше
Размещено От Cheeky Man
A A.
A A.
User
Автор

You mean create .js file and then add it through WebsiteX5 file attachment?

I will try it. thanks.

Читать больше
Размещено От A A.
A A.
A A.
User
Автор

Yes, putting my script into js file and then adding it through HTML and widget box expert tab worked. If you do it, make sure that you click on "link to the page" checkbox. It would basically put the script into the head section of the page. You can put the code there manually, but of course doing it with separate js file is much better because if you need to edit the script later on, you have to do it only in one place - your js file.

Читать больше
Размещено От A A.