简体   繁体   English

(localhost)meta http-equiv在Android浏览器上不起作用

[英](localhost) meta http-equiv don't work on android browsers

I have a refresh page with javascript and php to submit data to database and return to the main menu page, i'm using localhost with MAMP and it works fine at the desktop, but when i use android browsers to access the localhost project, the function don't work. 我有一个使用javascript和php的刷新页面将数据提交到数据库并返回主菜单页面,我正在使用带有MAMP的localhost,它在桌面上工作正常,但是当我使用Android浏览器访问localhost项目时,功能不起作用。

<body> <?php
    if(mysqli_affected_rows($conn) != 0){
        echo "

            <META HTTP-EQUIV=REFRESH CONTENT = '0;URL=http://localhost:8885/PCW/login/admin.php'>
            <script type=\"text/javascript\">
                alert(\"Sucess.\");
            </script>
        ";  

. What i can do to make it work in android browsers? 我能做些什么让它在Android浏览器中运行? Thank you. 谢谢。

I'm not sure that the Android browser will resolve localhost the same way as your machine. 我不确定Android浏览器是否会以与机器相同的方式解析localhost。 Most machines resolve localhost to 127.0.0.1. 大多数计算机将localhost解析为127.0.0.1。

Are you testing this in the Android emulator? 你在Android模拟器中测试这个吗? If so localhost resolves to 10.0.2.2. 如果是这样localhost解析为10.0.2.2。 Have you tried using that ip when running in an Android browser? 在Android浏览器中运行时,您是否尝试过使用该IP?

Otherwise, have you tried using the internal IP of the localhost web server rather than localhost? 否则,您是否尝试过使用localhost Web服务器的内部IP而不是localhost?

Meta tag is part of the head. 元标记是头部的一部分。
If you place it in the body as you have, it may or may not work. 如果您将它放在身体中,它可能会也可能不会起作用。

Try and move it to it's correct location (in head) and see if that helps. 尝试将其移动到正确的位置(头部)并查看是否有帮助。

Hey guys i fixed this changing the localhost on code to my ip. 嘿家伙我修复了这个改变代码上的localhost到我的IP。 So now is this 所以现在就是这样

URL=http://0.0.0.0:8885/PCW/login/admin.php'>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用时阻止js - Block js when using <meta http-equiv=“refresh” http-equiv =“内容语言”不起作用(element.lang =“”) - http-equiv=“content-language” doesn't work (element.lang = “”) 使用Javascript和http-equiv重定向 - Redirects with Javascript and http-equiv 在jQuery中,为什么查询“ meta [name]”和“ meta [http-equiv]”时“ this”的值不同? - in jQuery, why is the value of “this” when querying 'meta[name]' different from 'meta[http-equiv]' different? 新增中 <meta http-equiv=“X-UA-Compatible” content=“IE=9” /> 使用JavaScript - Adding <meta http-equiv=“X-UA-Compatible” content=“IE=9” /> using javascript 在Node.js中,如何在 <meta http-equiv> 标签 - in Node.js, how to get set-cookie value in a <meta http-equiv> tag 内容页面<meta http-equiv=“X-UA-Compatible” content=“IE=10”/> - Content page with <meta http-equiv=“X-UA-Compatible” content=“IE=10”/> 如何加载meta http-equiv =“ REFRESH” content =“ 0; URL =“ somedomain”进入div。 - how to load meta http-equiv=“REFRESH” content=“0; URL=”somedomain" into a div. 将JS变量传递到元标记http-equiv = refresh到url字段中 - Pass JS variable into meta tag http-equiv=refresh into url field Javascript HTTP-EQUIV似乎不起作用 - Javascript HTTP-EQUIV Does Not Seem To Be Working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM