开发者

See stored cookies or debug in browser

开发者 https://www.devze.com 2023-01-31 22:58 出处:网络
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开发者_高

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.


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


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!


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号