|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | + |
| 4 | +<head> |
| 5 | + <meta charset="utf-8"> |
| 6 | + <title>Browser Navigation Instrumentation Example</title> |
| 7 | + <base href="/"> |
| 8 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 9 | +</head> |
| 10 | + |
| 11 | +<body> |
| 12 | + <h1>🧭 Browser Navigation Instrumentation Example</h1> |
| 13 | + <p>This example demonstrates the <strong>Browser Navigation Instrumentation</strong> package with enhanced Navigation API support, custom log record data, and comprehensive event tracking.</p> |
| 14 | + |
| 15 | + <div class="info-panel"> |
| 16 | + <h3>📊 Features Demonstrated:</h3> |
| 17 | + <ul> |
| 18 | + <li>✅ <strong>Navigation API Support:</strong> Modern browser navigation events</li> |
| 19 | + <li>✅ <strong>History API Tracking:</strong> pushState, replaceState, popstate events</li> |
| 20 | + <li>✅ <strong>Hash Change Detection:</strong> Fragment navigation tracking</li> |
| 21 | + <li>✅ <strong>Custom Log Attributes:</strong> Custom attribute injection</li> |
| 22 | + <li>✅ <strong>URL Sanitization:</strong> Automatic credential and sensitive data redaction</li> |
| 23 | + <li>✅ <strong>Same-Document Navigation:</strong> SPA-style navigation detection</li> |
| 24 | + </ul> |
| 25 | + </div> |
| 26 | + |
| 27 | + <script type="text/javascript" src="/navigation.js"></script> |
| 28 | + <nav> |
| 29 | + <a href="/navigation/route1" data-link>Route 1</a> |
| 30 | + <a href="/navigation/route2" data-link>Route 2</a> |
| 31 | + <button id="hashChangeBtn">Test Hash Change</button> |
| 32 | + <button id="backBtn">Go Back</button> |
| 33 | + <button id="navApiHashBtn">Nav API: Hash</button> |
| 34 | + </nav> |
| 35 | + |
| 36 | + <div id="content"> |
| 37 | + <!-- Content will be loaded here --> |
| 38 | + </div> |
| 39 | + |
| 40 | + <div id="hash-content"> |
| 41 | + <!-- Hash content will be displayed here --> |
| 42 | + </div> |
| 43 | + |
| 44 | + <div id="nav-api-content"> |
| 45 | + <!-- Navigation API content will be displayed here --> |
| 46 | + </div> |
| 47 | + |
| 48 | + <style> |
| 49 | + .nav-result { |
| 50 | + margin: 10px 0; |
| 51 | + padding: 15px; |
| 52 | + border-radius: 8px; |
| 53 | + border-left: 4px solid #007acc; |
| 54 | + background-color: #f8f9fa; |
| 55 | + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; |
| 56 | + } |
| 57 | + .nav-result.error { |
| 58 | + border-left-color: #dc3545; |
| 59 | + background-color: #f8d7da; |
| 60 | + } |
| 61 | + .nav-result.fallback { |
| 62 | + border-left-color: #ffc107; |
| 63 | + background-color: #fff3cd; |
| 64 | + } |
| 65 | + .nav-result h4 { |
| 66 | + margin: 0 0 10px 0; |
| 67 | + color: #333; |
| 68 | + } |
| 69 | + .nav-result code { |
| 70 | + background-color: #e9ecef; |
| 71 | + padding: 2px 6px; |
| 72 | + border-radius: 4px; |
| 73 | + font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; |
| 74 | + } |
| 75 | + .nav-result ul { |
| 76 | + margin: 10px 0; |
| 77 | + padding-left: 20px; |
| 78 | + } |
| 79 | + .nav-result li { |
| 80 | + margin: 5px 0; |
| 81 | + } |
| 82 | + .console-note { |
| 83 | + font-style: italic; |
| 84 | + color: #6c757d; |
| 85 | + margin-top: 10px; |
| 86 | + } |
| 87 | + .info-panel { |
| 88 | + margin: 20px 0; |
| 89 | + padding: 15px; |
| 90 | + background-color: #e8f4fd; |
| 91 | + border-radius: 8px; |
| 92 | + border-left: 4px solid #007acc; |
| 93 | + } |
| 94 | + .info-panel h3 { |
| 95 | + margin-top: 0; |
| 96 | + color: #007acc; |
| 97 | + } |
| 98 | + .info-panel ul { |
| 99 | + margin: 10px 0; |
| 100 | + padding-left: 20px; |
| 101 | + } |
| 102 | + .info-panel li { |
| 103 | + margin: 8px 0; |
| 104 | + } |
| 105 | + nav { |
| 106 | + margin: 20px 0; |
| 107 | + padding: 15px; |
| 108 | + background-color: #f1f3f4; |
| 109 | + border-radius: 8px; |
| 110 | + } |
| 111 | + nav a, nav button { |
| 112 | + margin: 5px 10px 5px 0; |
| 113 | + padding: 8px 16px; |
| 114 | + text-decoration: none; |
| 115 | + background-color: #007acc; |
| 116 | + color: white; |
| 117 | + border: none; |
| 118 | + border-radius: 4px; |
| 119 | + cursor: pointer; |
| 120 | + font-size: 14px; |
| 121 | + } |
| 122 | + nav a:hover, nav button:hover { |
| 123 | + background-color: #005a9e; |
| 124 | + } |
| 125 | + body { |
| 126 | + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; |
| 127 | + line-height: 1.6; |
| 128 | + margin: 20px; |
| 129 | + color: #333; |
| 130 | + } |
| 131 | + h1 { |
| 132 | + color: #007acc; |
| 133 | + border-bottom: 2px solid #007acc; |
| 134 | + padding-bottom: 10px; |
| 135 | + } |
| 136 | + </style> |
| 137 | + |
| 138 | +</body> |
| 139 | + |
| 140 | +</html> |
0 commit comments