I use standard Bitrix web forms. I created a button on the site that, when clicked, using Ajax, loads the form and opens it in a modal window. opening in a window made on fancybox. The problem is that when I am authorized the form opens on all pages of the site. When I am not authorized the form opens on the main page and on the product page. on the second and third depths the form does not open, and the following error is written to the console (Chrome):

VM26703: 1 Uncaught TypeError: Cannot read property 'history' of undefined

waters in VM26703:

if (top.BX.ajax.history.bHashCollision) top.BX.ajax.history.checkRedirectFinish('bxajaxid', 'e64f5e91a45eff43e702620a388eff2e'); 

Call form code:

 $('a.button').fancybox({ 'overlayShow': false, 'padding': 0, 'margin' : 0, 'scrolling' : 'no', 'titleShow': false, 'type': 'ajax', 'href': SITE_TEMPLATE_PATH + '/ajax/buy1click_form.php', }); 

    1 answer 1

    It helped:

     <? if (!$USER->IsAuthorized()) { CJSCore::Init(array('ajax', 'json', 'ls', 'session', 'jquery', 'popup','pull')); } ?> 

    Add to header.php after <?$APPLICATION->ShowHead()?>