我有两个php页面,当页面加载时Google Chrome给我同样的错误:
未捕获(承诺)的DOMException
根据Chrome的显示,它出现在页面的第一行,但是页面的第一行只是html声明()。不幸的是,Chrome浏览器没有提供更多详细信息。
所以我的问题是我应该怎么做才能解决此问题?
页面的代码很长,在出现此错误之前,我没有对其进行任何更改。我确实对.js文件(仅在两个页面之一中被调用)和样式表文件(这是.php文件并且在两个页面中均被调用)进行了更改。
由于这个原因,我认为样式表代码就是我应该在此处发布的代码,但是如果需要其他代码,请这样说。
.php作为样式表:
<?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;}
该网站(如果有人想对其进行实时检查)是 MTDlist.com 。如前所述,错误将在页面加载中出现在控制台中。
我已经尝试寻找答案。我发现的只是关于使用音频/视频的答案以及关于javascript的答案。我什至都不明白该错误的含义,因此,如果您除了可以帮助我解决问题之外,还可以解释它,那就太好了!谢谢。