Easily switch between the Experience Editor and normal mode in Sitecore
Thursday, February 25, 2016
Labels:
Sitecore
So, I got in the habit of including `sc_mode=normal` in what bookmarks I do have. And, then I simply change that to `sc_mode=edit` in the address bar when needed and vice-versa. But, that has grown old also.
So, today I created a simple bookmarklet that edits the current page's `sc_mode` on the query string.
Change to edit mode.
Drag [this link] to your bookmarks bar.Here is the code:
javascript:(function(){
var q={},i,a=window.location.search.substr(1).split("&");
for(i in a){
q[a[i].split("=")[0]]=a[i].split("=")[1];
}
q['sc_mode']='edit';
a=[];
for(i in q){
a[a.length]=i+'='+q[i];
}
window.location.search='?'+a.join('&');
}());
One line:
javascript:(function(){var q={},i,a=window.location.search.substr(1).split("&");for(i in a){q[a[i].split("=")[0]]=a[i].split("=")[1];}q['sc_mode']='edit';a=[];for(i in q){a[a.length]=i+'='+q[i];}window.location.search='?'+a.join('&');}());
Change to normal mode.
Drag [this link] to your bookmarks bar.
Here is the code:
javascript:(function(){
var q={},i,a=window.location.search.substr(1).split("&");
for(i in a){
q[a[i].split("=")[0]]=a[i].split("=")[1];
}
q['sc_mode']='normal';
a=[];
for(i in q){
a[a.length]=i+'='+urlEncode(q[i]);
}
window.location.search='?'+a.join('&');
}());
One line:
javascript:(function(){var q={},i,a=window.location.search.substr(1).split("&");for(i in a){q[a[i].split("=")[0]]=a[i].split("=")[1];}q['sc_mode']='normal';a=[];for(i in q){a[a.length]=i+'='+q[i];}window.location.search='?'+a.join('&');}());
Alternate between edit and normal modes with one bookmarklet.
Drag [this link] to your bookmarks bar.
Here is the code:
javascript:(function(){
var q={},i,a=window.location.search.substr(1).split("&");
for(i in a){
q[a[i].split("=")[0]]=a[i].split("=")[1];
}
if(q['sc_mode']!=='edit'){
q['sc_mode']='edit';
}else{
q['sc_mode']='normal';
}
a=[];
for(i in q){
a[a.length]=i+'='+urlEncode(q[i]);
}
window.location.search='?'+a.join('&');
}());
One line: