Search code examples
javascripthttpsxmlhttprequesttypo3mixed-content

Replace HTTP with HTTPS on var siteurl to remove the xmlhttprequest error


I have this error :

Mixed content the page at was loaded over https but requested an insecure xmlhttprequest endpoint

When checked to source code i find this javascript :

HTML OUTPUT :

    var checkTasksInterval=10000;
    var taskesstr='111';
    var thispageid=1;
    var siteurl='http://www.example.com/';

How can I change the var siteurl to https in this javascript ?

    <script language="JavaScript">
    var checkTasksInterval='.$sysconf['checkTasksInterval'].';
    var tasksstr=\''.$tasksstr.'\';
    var thispageid='.$GLOBALS['TSFE']->id.';
    var siteurl=\''.\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL').'\';
    </script>

Solution

  • The problem comes from the ajax siteurl call :

    I changed this :

    $.ajax({
        type: "GET",
        url: siteurl+surl,
    

    to :

    $.ajax({
        type: "GET",
        url: 'https://example.com/index.php?eID=tasksdata',