When you are building or maintaining a public-facing website, device channels are a pretty awesome way to divide 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.
Bookmarklets 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
- Add a new bookmark to the favorite bar of your preferred browser
- Right-click it to edit properties
- 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’; - Add another bookmark
- 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.
Orginally posted on: http://blog.theauroraproject.com/easy-device-channel-switching-using-bookmarklets/