Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How do I call all my javascript from a sub-domain? Please? 
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Hello,

I have been digging in the code for days now, but without success - so I would appreciate your help here.

I need to call all the javascript from a sub-domain - so it would need to be called from sub.domain.com instead of from domain.com.

Do you have any suggestion on how to achieve this?

Many thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Anybody - any suggestions?

 
Magento Community Magento Community
Magento Community
Magento Community
 
vianetz
Guru
 
Avatar
Total Posts:  537
Joined:  2008-04-13
Munich, Germany
 

You have to explain the problem a little bit more in detail.

But I suggest this is not possible without modifying the core code which is extremely unsupported and unrecommendable.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Unirgy
Guru
 
Avatar
Total Posts:  478
Joined:  2007-09-07
 

did you try configuring Configuration > Web > Base Javascript URL ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Saharian,

You are a complete genius. Thank you. Thank you. Thank you. Did I say THANK YOU?

I completely missed to look in the config section. Just did not consider that it could be there.

Now - a word of warning for those trying to do the same - base JS url is, by default:

{{unsecure_base_url}}js/

If you change that to something else and it does NOT work - your admin will not work either, as it will mess up the admin JS as well. Solution - manual database edit of base JS url value.

Now - the mistake I made was typing:

subdomain.{{unsecure_base_url}}js/

However, that did not work, as it incoveniently put the “http://” inbetween “subdomain.” and “{{unsecure_base_url}}js/” when calling the JS.

I also tried “{{subdomain.unsecure_base_url}}js/” - but that did not work either. I wish I knew how to just add my subdomain in there somehow, but for now, I’m just doing it like this:

http://subdomain.domain.com/js/

This works! If you use SSL remember to do the same for the secure section, but with https

Many thanks again Saharian. Your help is very much appreciated!
smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

I’m assuming your store is in a sub domain and you needed to change the javascript “base” URL accordingly ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
lisali
Enthusiast
 
Avatar
Total Posts:  889
Joined:  2008-04-28
London, UK
 

Hello nikefido,

No. Want to call certain things from one of our subdomains instead of from the main domain. But that’s solved now.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top