douduxia1551 2019-04-09 19:35
浏览 256

如何修复php中页面加载时出现的“Uncaught(in promise)DOMException”?

I have two php pages where Google Chrome gives me the same error when the page loads:

Uncaught (in promise) DOMException

This appears, according to Chrome, on line 1 on the page, however the first line of the page is just the html declaration (). Unfortunately, Chrome does not give any more details.

So my question is What should I do to fix this?

The page's code is very long, and I have made no change to it before this error appeared. I did make changes to the .js file (which is only been called in one of the two pages) and the stylesheet file (which is a .php file and been called in both pages).

Due to this, I think the stylesheet code is what I should post here, but if another code is needed please say so.

.php as stylesheet:

<?php
header("Content-type: text/css; charset: UTF-8");
header("Expires: Tue, 01 Jan 2019 00:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Progma: no-cache");
?>
@import url('https://fonts.googleapis.com/css?family=Rubik');
<?php
$connection=mysqli_connect("******","******","*******","******");
if(mysqli_connect_errno())echo 'Connection Failed!';
else{
    if(isset($_GET['userserial'])){
        $USER=mysqli_query($connection,"SELECT * FROM users WHERE serial='".$_GET['userserial']."'");
        if(mysqli_num_rows($USER)>0){
            while($ALANGUAGE=mysqli_fetch_assoc($USER)){
                $LANGUAGE=$ALANGUAGE['language'];
                $LOWNUMBER=0;
                $R=ord(substr($ALANGUAGE['fname'],1,1))-ord(substr($ALANGUAGE['lname'],1,1));
                if($R<0)$R*=-1;
                while($R>16)$R-=16;
                if($R<0)$R*=-1;
                if($R<=6)$LOWNUMBER++;
                if($R>9){$R+=87;$R=chr($R);}
                $G=ord(substr($ALANGUAGE['lname'],0,1))-ord(substr($ALANGUAGE['lname'],strlen($ALANGUAGE['lname'])-2,1));
                if($G<0)$G*=-1;
                if($G>7)$G-=4;
                    else if($G<7)$G+=2;
                while($G>16)$G-=16;
                if($G<0)$G*=-1;
                if($G<=6)$LOWNUMBER++;
                if($G>9){$G+=87;$G=chr($G);}
                $B=ord(substr($ALANGUAGE['fname'],0,1))-ord(substr($ALANGUAGE['fname'],strlen($ALANGUAGE['fname'])-2,1));
                if($B<0)$B*=-1;
                while($B>16)$B-=16;
                if($B<0)$B*=-1;
                if($B<=6)$LOWNUMBER++;
                if($B>9){$B+=87;$B=chr($B);}

                if($LOWNUMBER==3)$TEXTCOLOR="#ffffff";
                    else $TEXTCOLOR="#000000";
            }}
    }
    else $LANGUAGE='en';
    $USERLANGUAGE=mysqli_query($connection,"SELECT * FROM languages WHERE   languagecode='".$LANGUAGE."'");
    if(mysqli_num_rows($USERLANGUAGE)>0){
        while($THELANGUAGE=mysqli_fetch_assoc($USERLANGUAGE)){
            if($THELANGUAGE['align']=='right')$OTHERSIDE='left';
            if($THELANGUAGE['align']=='left')$OTHERSIDE='right';
            echo "*{font-family:'Rubik','Helvetica','Arial',sans-serif;text-align:".$THELANGUAGE['align'].";}html,body{padding:0;margin:0;direction:".$THELANGUAGE['direction'].";}.duedate{position:absolute;bottom:1px;".$OTHERSIDE.":2px;font-size:10px;}#username{position:absolute;top:3px;".$THELANGUAGE['align'].":8px;width:calc(1.2cm - 8px);height:calc(1.0cm - 9px);padding-top:calc(0.2cm + 1px);border-radius:50%;border:1px solid #cdcdcd;text-align:center;font-size:18px;background-color:#".$R.$R.$G.$G.$B.$B.";color:".$TEXTCOLOR.";}#menu{position:absolute;top:2px;".$OTHERSIDE.":8px;width:calc(1.2cm - 4px);height:calc(1.0cm - 4px);padding-top:0.2cm;text-align:center;}#popupblock div .option{text-align:".$OTHERSIDE."}.threebuttons:first-of-type{".$THELANGUAGE['align'].":calc(25% - 40px);".$OTHERSIDE.":calc(75% - 40px);}.threebuttons:last-of-type{".$OTHERSIDE.":calc(25% - 40px);".$THELANGUAGE['align'].":calc(75% - 40px);}";
        }}
}
?>
body{width:100wv;height:100hv;overflow:hidden;background:#e6f5ff;background:-moz-linear-gradient(top,#ddf1ff 10%,#eff8ff 100%);background:-webkit-linear-gradient(top,#ddf1ff 10%,#eff8ff 100%);background:linear-gradient(to bottom,#ddf1ff 10%,#eff8ff 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ddf1ff',endColorstr='#eff8ff',GradientType=0);}
.logobox{width:60px;height:48px;padding-top:12px;border:2px #000000 solid;border-radius:50%;text-align:center;margin:40px calc(50% - 30px) 50px;font-family:'Palatino';font-size:16px;}
#topblock,#titles,.typeandshared,.urgencylevel,.completed,.duedate,#bottomblock,.logobox{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
<?php
$connection=mysqli_connect("******","******","*******","******");
if(mysqli_connect_errno())echo 'Connection Failed!';
else{
    $USERSERIAL=$_GET['userserial']; //user's serial number

    // set color shade:
    $ALLSETTINGS=mysqli_query($connection,"SELECT * FROM settings");
    if(mysqli_num_rows($ALLSETTINGS)>0){
        while($SHADES=mysqli_fetch_assoc($ALLSETTINGS)){
        $PASTDUE_SHADE=$SHADES['pastdue_colour'];
        $LASTCHANCE_SHADE=$SHADES['lastchance_colour'];
        $CLOSETOEND_SHADE=$SHADES['closetoend_colour'];
        $OTHER_SHADE=$SHADES['other_colour'];
        $THERESTIME_SHADE=$SHADES['therestime_colour'];
        $COMPLETED_SHADE=$SHADES['completed_colour'];
        $HIGHLIGHT_SHADE=$SHADES['highlighted_colour'];
    }}
    $USERSETTINGS=mysqli_query($connection,"SELECT * FROM users WHERE serial='".$USERSERIAL."'");
    if(mysqli_num_rows($USERSETTINGS)>0){
        while($SELECTEDSHADES=mysqli_fetch_assoc($USERSETTINGS)){
        if($SELECTEDSHADES['pastdue_colour']!="")$PASTDUE_SHADE=$SELECTEDSHADES['pastdue_colour'];
        if($SELECTEDSHADES['lastchance_colour']!="")$LASTCHANCE_SHADE=$SELECTEDSHADES['lastchance_colour'];
        if($SELECTEDSHADES['closetoend_colour']!="")$CLOSETOEND_SHADE=$SELECTEDSHADES['closetoend_colour'];
        if($SELECTEDSHADES['other_colour']!="")$OTHER_SHADE=$SELECTEDSHADES['other_colour'];
        if($SELECTEDSHADES['therestime_colour']!="")$THERESTIME_SHADE=$SELECTEDSHADES['therestime_colour'];
        if($SELECTEDSHADES['completed_colour']!="")$COMPLETED_SHADE=$SELECTEDSHADES['completed_colour'];
        if($SELECTEDSHADES['highlighted_colour']!="")$HIGHLIGHT_SHADE=$SELECTEDSHADES['highlighted_colour'];
    }}
    echo '.alertlevel1{background-color:'.$PASTDUE_SHADE.';}';
    echo '.alertlevel2{background-color:'.$LASTCHANCE_SHADE.';}';
    echo '.alertlevel3{background-color:'.$CLOSETOEND_SHADE.';}';
    echo '.alertlevel4{background-color:'.$OTHER_SHADE.';}';
    echo '.alertlevel5{background-color:'.$THERESTIME_SHADE.';}';
    echo '.completedtask{background-color:'.$COMPLETED_SHADE.';}';
    echo '.highlight .description,.highlight .completed,.highlight .typeandshared{background-color:'.$HIGHLIGHT_SHADE.';}';
}
?>
.completed{text-align:center;}
.completed i{font-size:20px;margin-top:3px;}
#singlemessage{display:inline-block;width:100%;height:90px;position:relative;text-align:center;}
.threebuttons{width:80px;height:40px;position:absolute;left:calc(50% - 40px);right:calc(50% - 40px);text-align:center;}
::-webkit-scrollbar{width:0;height:0;}

The site, if anyone wants to check it live, is MTDlist.com. As said before, the error will appear in the console on the page loading.

I have tried to look for an answer. All I found is answers about using audio/video and answers about javascript. I also didn't even understand what this error means, so if you could explain it in addition to helping me with a solution, that would be awesome! Thanks.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制
    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办