#19224 closed defect (bug) (invalid)
ajaxurl not defined for Android / iPhone browsers
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.2.1 |
| Component: | General | Keywords: | |
| Focuses: | Cc: |
Description
When trying to do an ajax call using the ajaxurl variable, it works perfectly in a desktop browser but not from my smartphone, HTC Desire HD using their standard browser. The problem has also been reproduced using an iPhone 4.
I've verified this as an issue using the Twenty Eleven theme and without any plugins, using WordPress 3.2.1 multisite installation.
Steps to reproduce:
- Go to jsconsole.com
- Type :listen
- Copy the javascript and insert it into the footer of the Twenty Eleven theme
- Open site with your smartphone
- Try sending 'ajaxurl', 'console.log(ajaxurl)' or 'alert(ajaxurl)' from jsconsole
The result from this command sent to the phone browser is:
ajaxurl is not defined
I've ruled out issues with jsconsole.com by trying to send something else to the phone browser and looking at the response. For instance 'window', 'document.title' and 'window.localStorage' all returns the correct result from the phone browser.
Going to the same site with my Chrome browser, typing ajaxurl into the console gives:
Change History (5)
#2
@
14 years ago
Yes.
This code:
<script>alert('hello'); alert(ajaxurl);</script>
Will alert "Hello" but nothing more. Same result for my HTC Desire HD and iPhone 4.
#3
@
14 years ago
Update:
It now seems more like the issue is that the ajaxurl variable is only getting defined for users that are signed in, which is still an issue but it doesn't seem like it's related to the platform/browser.
FWIW, it definitely works in Opera Mobile in the Admin at least.
Does
<script>alert(ajaxurl);</script>fail when placed in the footer as well?