File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
templates/default/fulldoc/html Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 5
5
< title > <%= options . title %> </ title >
6
6
</ head >
7
7
< script type ="text/javascript ">
8
- var match = decodeURIComponent ( window . location . hash ) . match ( / ^ # ! ( .+ ) / ) ;
9
- var name = match ? match [ 1 ] : '<%= url_for_main %> ' ;
10
- name = name . replace ( / ^ ( ( \w * ) : ) ? [ \/ \\ ] * / gm, '' ) . trim ( ) ;
11
- window . top . location . replace ( name )
8
+ var mainUrl = '<%= url_for_main %> ' ;
9
+ try {
10
+ var match = decodeURIComponent ( window . location . hash ) . match ( / ^ # ! ( .+ ) / ) ;
11
+ var name = match ? match [ 1 ] : mainUrl ;
12
+ var url = new URL ( name , location . href ) ;
13
+ window . top . location . replace ( url . origin === location . origin ? name : mainUrl ) ;
14
+ } catch ( e ) {
15
+ window . top . location . replace ( mainUrl ) ;
16
+ }
12
17
</ script >
13
18
< noscript >
14
19
< h1 > Oops!</ h1 >
You can’t perform that action at this time.
0 commit comments