3

My question is fairly simple, seeing as iPod has full support for executing JavaScript (proven my bookmarklets (See below) why doesn't it have a "dev tools" option, or at least a JS console? Is there a specific reason for this feature not to exist standalone mobile?

Or am I blind and that it's actually there?*

As for the bookmarklets it's fairly simple, navigate to blank.org (or any site really), bookmark it, edit the bookmark and replace it with something like this;

javascript:void(document.bgColor=prompt('Color?%20Hex%20or%20name%20will%20do.%20May%20I%20suggest%20red?','red'))

Or any JS code after javascript:

Not my code, you can find code where I got this from at http://code.tutsplus.com/tutorials/create-bookmarklets-the-right-way--net-18154*

2

Well, we can only speculate as to why Apple doesn't include a JavaScript console but we can make some assumptions.

  • Screen real-estate is limited on a mobile device, and it would be cumbersome to use (imagine trying to code with an iPhone keyboard).

  • Mobile devices are, in general, not intended for web development. Apple wants to keep their UI/UX as streamlined as possible. Including a feature which, in Apple's opinion, is unnecessary, works against this goal.

3

You mention "standalone" so you may be aware of this already and have discounted it, but I thought I'd mention it anyway just in case.

It is possible to use the development tools within Safari on a Mac (including the JavaScript console) to diagnose faults and develop sites for iOS devices.

  • Connect your iPhone or iPad to your Mac using a USB cable.
  • On your iOS device, go into the Settings, select Safari then Advanced. You should see a switch for "Web Inspector". Switch it on.
  • On your Mac, go into the Preferences within Safari and on the Advanced tab you should see a tick box for "Show Develop menu in menu bar". Tick it.
  • Now if you open the Develop menu within Safari on your Mac you should now see a submenu for your iOS device listing the available "inspectable applications". I've only seen Safari on this list, but I assume other applications that use UIWebViews are inspectable too.

Arguably more useful than having web development tools built into the devices themselves.

  • I am with windows for pcs. In my opinion windows is a great company for computers, and apple should stick with mobiles :D I have no Mac, although I do believe safari comes for windows also? I still don't know why there is none built in themselves however. – warspyking Jan 17 '15 at 0:59
  • Apple stopped releasing Safari for Windows a few years ago. As Chris said in the other answer, using it on a device you are trying to inspect and write code would be cumbersome at best. There are iPad apps that allow you to write/test/etc code with a built in JavaScript console. For example CodePad. – Alistair McMillan Jan 17 '15 at 2:21
  • Works like a charm. Touch events are much slower but that makes sense seeing the route the data needs to make. – wcochran Aug 19 '16 at 0:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .