Quantcast
Channel: Mavention
Viewing all articles
Browse latest Browse all 627

Easy device channel switching using bookmarklets

$
0
0

​​​​​​When you are building or maintaining a public-facing website, device channels are a pretty awesome way to divid​e the authoring environment and the actual website. Basicly you have a (sort of) standard SharePoint Masterpage with al your SharePoint authoring goodies, like ribbons, webpart properties etc. and a clean, lean and mean masterpage to show your visitors.

Switching between different device channels can be a bit of a hassle though. You need to go to the ribbon, click on page, click on preview and choose the correct device channel.

channel-switch 

Bookmar​​klets to the rescue

Wouldn’t it be nice to have a button at your disposal to easily switch beteween views? You can with Bookmarklets​.

The way SharePoint device channel preview works is that a query string is added, namely ?PagePreview=true&DeviceChannel=Default .
Adding this to your URL will render the page in a specific devicechannel. With bookmarklets you can make a button that will add this query string to you URL.

What to do

  1. A​dd a new bookmark to the favorite bar of your preferred browser ​
  2. Right-click it to edit properties
  3. For Publishing view, change the title to ‘Publishing view’ and the URL to
    javascript: window.location = window.location.protocol + ‘//’ + window.location.hostname + window.location.pathname + ‘?PagePreview=true&DeviceChannel=Default’;​
  4. Add another bookmark
  5. For Authoring view, change the title to ‘Authoring view’ and the URL to
    javascript: window.location = window.location.protocol + ‘//’ + window.location.hostname + window.location.pathname;

And that’s it. You can now easily switch between the front-​end and back-end of the website. In Internet Explorer you can even add your own custom icon.

switch-buttons 

Orginally posted on: http://blog.th​eauroraproject.co​m/easy-device-channel-switching-using-bookmarklets/​​​​


Viewing all articles
Browse latest Browse all 627

Trending Articles