<p>要使用<iframe>实现页面跳转而URL不变,可以将要跳转的页面嵌套在<iframe>标签中。具体的代码如下:</p>
<pre><code class="language-html">&lt;div class=&quot;Polaris-Stack Polaris-Stack--distributionEqualSpacing Polaris-Stack--alignmentCenter&quot; style=&quot;margin-top: 1px;border-bottom: 1px #c1c1c1 solid;padding: 5px;&quot;&gt;
	&lt;div class=&quot;Polaris-Stack__Item&quot;&gt;
		&lt;div class=&quot;Polaris-Stack Polaris-Stack--spacingTight Polaris-Stack--alignmentCenter&quot;&gt;
			&lt;div class=&quot;Polaris-Stack__Item&quot;&gt;
				&lt;div class=&quot;sc-1ibht3l-0 uqRZq&quot;&gt;&lt;/div&gt;
				&lt;div class=&quot;sc-1ibht3l-1 hIZedH&quot;&gt;
					&lt;div class=&quot;Polaris-ButtonGroup&quot;&gt;
						&lt;div class=&quot;Polaris-ButtonGroup__Item&quot;&gt;
							&lt;a data-polaris-unstyled=&quot;true&quot; class=&quot;Polaris-Button&quot; href=&quot;index.html&quot; target=&quot;my-iframe&quot;&gt;
								&lt;span class=&quot;Polaris-Button__Content&quot;&gt;
									&lt;span class=&quot;Polaris-Button__Text&quot;&gt;Dashboard&lt;/span&gt;
								&lt;/span&gt;
							&lt;/a&gt;
						&lt;/div&gt;
						&lt;div class=&quot;Polaris-ButtonGroup__Item&quot;&gt;
							&lt;a data-polaris-unstyled=&quot;true&quot; class=&quot;Polaris-Button&quot; href=&quot;zone.html&quot; target=&quot;my-iframe&quot;&gt;
								&lt;span class=&quot;Polaris-Button__Content&quot;&gt;
									&lt;span class=&quot;Polaris-Button__Text&quot;&gt;Checkout Zones&lt;/span&gt;
								&lt;/span&gt;
							&lt;/a&gt;
						&lt;/div&gt;
						&lt;div class=&quot;Polaris-ButtonGroup__Item&quot;&gt;
							&lt;a data-polaris-unstyled=&quot;true&quot; class=&quot;Polaris-Button&quot; href=&quot;funnel.html&quot; target=&quot;my-iframe&quot;&gt;
								&lt;span class=&quot;Polaris-Button__Content&quot;&gt;
									&lt;span class=&quot;Polaris-Button__Text&quot;&gt;Funnels&lt;/span&gt;
								&lt;/span&gt;
							&lt;/a&gt;
						&lt;/div&gt;
						&lt;div class=&quot;Polaris-ButtonGroup__Item&quot;&gt;
							&lt;a data-polaris-unstyled=&quot;true&quot; class=&quot;Polaris-Button&quot; href=&quot;help.html&quot; target=&quot;my-iframe&quot;&gt;
								&lt;span class=&quot;Polaris-Button__Content&quot;&gt;
									&lt;span class=&quot;Polaris-Button__Text&quot;&gt;Help Center&lt;/span&gt;
								&lt;/span&gt;
							&lt;/a&gt;
						&lt;/div&gt;
						&lt;div class=&quot;Polaris-ButtonGroup__Item&quot;&gt;
							&lt;div&gt;
								&lt;button type=&quot;button&quot; id=&quot;moreSeting&quot; class=&quot;Polaris-Button&quot; tabindex=&quot;0&quot; aria-controls=&quot;Popover486&quot; aria-owns=&quot;Popover486&quot; aria-haspopup=&quot;true&quot; aria-expanded=&quot;false&quot;&gt;
									&lt;span class=&quot;Polaris-Button__Content&quot;&gt;
										&lt;span class=&quot;Polaris-Button__Text&quot;&gt;More&lt;/span&gt;
										&lt;span class=&quot;Polaris-Button__Icon&quot;&gt;
											&lt;span class=&quot;Polaris-Icon&quot;&gt;
												&lt;svg viewBox=&quot;0 0 20 20&quot; class=&quot;Polaris-Icon__Svg&quot; focusable=&quot;false&quot; aria-hidden=&quot;true&quot;&gt;
													&lt;path d=&quot;M5 8l5 5 5-5z&quot; fill-rule=&quot;evenodd&quot;&gt;&lt;/path&gt;
												&lt;/svg&gt;
											&lt;/span&gt;
										&lt;/span&gt;
									&lt;/span&gt;
									&lt;div id=&quot;dropdownContent&quot; class=&quot;dropdown-content&quot;&gt;
										&lt;a href=&quot;payment.html&quot; target=&quot;my-iframe&quot;&gt;Payment&lt;/a&gt;
										&lt;a href=&quot;facebookPixel.html&quot; target=&quot;my-iframe&quot;&gt;Pixel&lt;/a&gt;
									&lt;/div&gt;
								&lt;/button&gt;
							&lt;/div&gt;
						&lt;/div&gt;
					&lt;/div&gt;
				&lt;/div&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;

&lt;iframe name=&quot;my-iframe&quot; src=&quot;http://127.0.0.1/&quot; frameborder=&quot;0&quot; style=&quot;width:100%; height:100%;&quot;&gt;&lt;/iframe&gt;
</code></pre>
<p>在上面的代码中,我为每个链接添加了<code>target=&quot;my-iframe&quot;</code>属性,这样点击链接时,页面会在名为<code>my-iframe</code>的<iframe>中打开。并且我在代码的最后添加了一个<iframe>标签,用于展示页面内容。将该代码放在HTML页面的合适位置即可实现在<iframe>中跳转页面而URL不变</p>
HTML页面跳转到另一个界面了但是URL不变比说 http127001 我请求 http127001下面的uphtml网页上的url还是 http127001结合下面的代码使用iframe实现给我具体的代码div class=Polaris-Stack Polaris-Stack--distributionEqualSpacing Polaris-Stack--alignmentCenter

原文地址: https://www.cveoy.top/t/topic/inru 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录