@@ -88,8 +88,12 @@ function embedSharedBookmark(enableFilterPane, bookmarkState) {
8888 // We give the user View permissions
8989 var permissions = models . Permissions . View ;
9090
91- // Get the bookmark state from url param
92- var bookmarkState = GetBookmarkStateFromURL ( ) ;
91+ // Get the bookmark name from url param
92+ var bookmarkName = GetBookmarkNameFromURL ( ) ;
93+
94+ // Get the bookmark state from local storage
95+ // any type of database can be used
96+ var bookmarkState = localStorage . getItem ( bookmarkName ) ;
9397
9498 // Embed configuration used to describe the what and how to embed
9599 // This object is used when calling powerbi.embed
@@ -227,7 +231,11 @@ function shareBookmark(element) {
227231 let currentBookmark = getBookmarkByID ( bookmarkId ) ;
228232
229233 // Build the share bookmark URL
230- let shareUrl = location . href . substring ( 0 , location . href . lastIndexOf ( "/" ) ) + '/shareBookmark.html' + '?state=' + currentBookmark . state ;
234+ let shareUrl = location . href . substring ( 0 , location . href . lastIndexOf ( "/" ) ) + '/shareBookmark.html' + '?name=' + currentBookmark . name ;
235+
236+ // Store bookmark state with name as a key on the local storage
237+ // any type of database can be used
238+ localStorage . setItem ( currentBookmark . name , currentBookmark . state ) ;
231239
232240 // Set bookmark display name and share URL on dialog HTML code
233241 $ ( '#dialogBookmarkName' ) . empty ( ) ;
@@ -284,10 +292,10 @@ function buildShareElement() {
284292 return imgElement ;
285293}
286294
287- // Get the bookmark state from url 'state ' argument
288- function GetBookmarkStateFromURL ( ) {
295+ // Get the bookmark name from url 'name ' argument
296+ function GetBookmarkNameFromURL ( ) {
289297 url = window . location . href ;
290- let regex = new RegExp ( "[?&]state (=([^&#]*)|&|#|$)" ) ,
298+ let regex = new RegExp ( "[?&]name (=([^&#]*)|&|#|$)" ) ,
291299 results = regex . exec ( url ) ;
292300 if ( ! results ) return null ;
293301 if ( ! results [ 2 ] ) return '' ;
0 commit comments