See stored cookies or debug in browser

僤鯓⒐⒋嵵緔 提交于 2021-01-27 16:45:23

问题


I have made a webpage that stores cookies to remember what ID a user has put in a scheme viewer. It works in desktop versions of IE, Firefox and Chrome. But when I try to visit it with Android or iPhone it doesn't work.

What I would like to know is how you see stored cookies or how you debug JavaScript/HTML/CSS. If I look at errors in desktop Firefox I get no errors for JavaScript and CSS.


回答1:


I recommend you use the remote debugger built into the chrome for android app.

e.g.

Start adb with your phone connected via usb (usb debugging enabled) Launch chrome, goto settings, developer tools, enable remote debugging. On your pc in command prompt execute adb forward tcp:9222 localabstract:chrome_devtools_remote

Navigate to localhost:9222 from your pc for live interaction/console from your phone.

Source: https://developers.google.com/chrome-developer-tools/docs/remote-debugging




回答2:


well i believe that you can't quite view the cookies of the browser in android. are you sure you have cookies enabled? (menu>more>settings>accept cookies should be checked). or if you're using javascript to set the cookies, you'd wanna make sure javascript is also enabled.

to debug, all you can really do is get the cookies via PHP or javascript and print them on the webpage. if they're blank, you for sure know the cookies aren't there. if you wanna see if the javascript is being run at all, just put print a "hello world" to the page at the line above where you set the cookie. (same concepts for php, use an echo)

it's a little fishy that desktop works and not mobile. it could be the fact that mobile browsers aren't rendering the page correctly though this is probably not the case. i would try debugging first and see if your setcookie code is actually being called by with the mobile browsers

hope this helps!




回答3:


For Android 2.2 or 2.3 you can try this:

  1. Type about:debug in you url bar while on your page;
  2. A javascript debug bar will be opened on top of your url bar;
  3. Type in console.log(document.cookie) and hit evaluate > It should print the cookies

Bear in mind that the js debug bar on Android will only show once the web app logs something ( e.g. if a js error occurs or if you trigger it via console.log so you might want to trigger it inside your app to open)

For Android above 2.3 you have more debug options ;)

EDITED:

As per Zeb's answer check here: https://developers.google.com/chrome-developer-tools/docs/remote-debugging



来源:https://stackoverflow.com/questions/4507243/see-stored-cookies-or-debug-in-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!