Header Ads

Breaking News
recent

View Website Source Code on iPad / iPhone

Visiting website and surfing is something that we all do with interest. We always search for new things new friends. Actually surfing internet can come up with so many new things that we cant even think of. Similarly, when we visit some website and if we like the interface of that website we always see the source code of that webpage. Ofcourse you dont get the detail code like .css and all but you get to see some code.

Now say, you are using Safari on iphone or ipad and you like to surf on website using this two devices. Similarly, if you like some website how will look at the source code of that page in safari? Safari browser does not have an inbuilt option to view the source code. So then you will have to visit that site in your pc. But, their's acool trick using which you can view the sorce code of the website directly in your iPad or iPhone browser.


Follow the steps below:

1. To get started, open your mobile Safari on your iPad/iPhone.

2.  Bookmark the page you are reading (or you can add a new bookmark) by clicking on the bookmark button. Instead of the page name, name it ‘View Source’ and then click ‘Save’.


3. Copy the javascript (shown below).

javascript:(function(){
    var w = window.open('about:blank'),
        s = w.document;
    s.write('');
    s.close();
    var f = s.body.appendChild(s.createElement('form'));
        f.setAttribute('method','post');
        f.setAttribute('action','http://ole.michelsen.dk/viewsource/?uri='+location.href);
    var i = f.appendChild(s.createElement('input'));
        i.setAttribute('type','hidden');
        i.setAttribute('name','DOM');
        i.setAttribute('value',encodeURIComponent(document.documentElement.innerHTML));
    f.submit();
})();


4. Tap on the bookmark icon at the top left part of your mobile Safari browser, and tap on ‘Edit’


5. Tap on the ‘View Source’ bookmark you created in step 1.


6. Now paste the bookmarklet javascript you copied in step 3 into the URL bar and tap ‘Done’.


7. The source code will look something like the image shown below:


That's it. Now you can view the source code of any webpage in your safari browser running on iPhone /iPad.

Source

If you like this post, please Like or Comment. For any queries, contact me on "bookofknowledge,blog@gmail.com".

Cheers!!!

No comments:

Powered by Blogger.