简体   繁体   中英

Cannot open links in new tab with jquery mobile

Why I can't open a link in new tab on my mobile phone? But when I tried running my script on the PC Desktop, that link can be opened in new tab..

This is my script

if($data[$flag] == 1){
    echo "<li><a href=\"img2.php?x=".$fix[0][0]."&y=".$fix[1][0]."\">Sektor ".($flag + 1)."</a></li>\n";}
    $flag++;

any suggestions?

Try it.

 if($data[$flag] == 1){
 echo "<li><a href=\"img2.php?x=".$fix[0][0]."&y=".$fix[1][0]."\" target="blank">Sektor ".($flag + 1)."</a></li>\n";}
$flag++;

target="blank" use for open a link in new tab

To force a link to open up in a new window/tab, you can use target="_blank" on the URL like this:

if($data[$flag] == 1){
    echo "<li><a href=\"img2.php?x=".$fix[0][0]."&y=".$fix[1][0]."\" target="_blank">Sektor ".($flag + 1)."</a></li>\n";}
    $flag++;

This should result in output that looks something like this:

<li><a href="img2.php?x=123&y=1456" target="_blank">Sektor 789</a></li>

Do bear in mind that the underscore in '_blank' is important.

Also worth mentioning is that this was depreciated from XHTML 1.1, but not from HTML5 . This is a common misconception in the development community.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM