查看ipad网页代码 iPad Quick Tip – View Page Source In iPad Safari

 

If you are a webmaster like me, and always wondered how to check the source of your web pages via your iPad, search no more: the folks at RavelRumba put together a nice “bookmarklet” that will allow you to have access to the source of the page you are looking at, simply by using a bookmark.

To get it to work, simply follow these steps:

 

  1. Go to this page, and copy the bookmarklet (tap for more than 1 second, hit “Select All” then “Copy”).
  2. Create a bookmark via the “Add Bookmark” function in Safari (the plus sign next to the address bar). Don’t worry about the actual page you are bookmarking, it does not matter.
  3. Open the “Bookmark Bar” (the icon that looks like a book), tap “Edit” to edit the bookmark you just created. Replace the bookmark name with something friendly like “Check Source”, and delete the address that was initially bookmarked. Replace it with the code you just copied (long tap, then “Paste”).
  4. Save the bookmark.

 

And voila, your iPad will now display the source of the page you are looking at, every time you use the “Check Source” bookmark. Kudos to RavelRumba for this simple yet extremely useful feature.

 

核心内容就是把下面的代码保存到书签网址里面:

 

 

javascript:(function(){var a=window.open('about:blank').document;a.write('<!DOCTYPE html><html><head><title>Source of '+location.href+'</title><meta name="viewport" content="width=device-width" /></head><body></body></html>');a.close();var b=a.body.appendChild(a.createElement('pre'));b.style.overflow='auto';b.style.whiteSpace='pre-wrap';b.appendChild(a.createTextNode(document.documentElement.innerHTML))})();

 

如果想查看当前网页的代码,就直接点击这个书签。

 

来源:   http://www.padgadget.com/2010/05/15/ipad-quick-tip-view-page-source-in-ipad-safari/

 

 

你可能感兴趣的:(Safari)