Php 在模式对话框中打开链接(如Chrome Web Store)

Php 在模式对话框中打开链接(如Chrome Web Store),php,javascript,jquery,dialog,modal-dialog,Php,Javascript,Jquery,Dialog,Modal Dialog,打开Chrome应用程序时,如何在Chrome Web Store上的模式对话框中打开url链接。注意shaddow中的背景Ramins,但它仍然是主页。并且URL会在Chrome Web Store中更改。对于对话框使用jQuery UI 使用JS更改URL使用历史API 也检查 对于您可能必须使用的旧浏览器,上面的jQueryUI站点就是一个很好的例子 要打开对话框中的所有链接,可以编写如下代码 $('a').click(function(e){ e.preventDefault()

打开Chrome应用程序时,如何在Chrome Web Store上的模式对话框中打开url链接。注意shaddow中的背景Ramins,但它仍然是主页。并且URL会在Chrome Web Store中更改。

对于对话框使用jQuery UI

使用JS更改URL使用历史API

也检查

对于您可能必须使用的旧浏览器,上面的jQueryUI站点就是一个很好的例子

要打开对话框中的所有链接,可以编写如下代码

$('a').click(function(e){
  e.preventDefault();
  var url=$(this).attr('href')+"?content_only"; //content_only added to tell index.php to give only content without template and JS
   $.get(url, function(data) {
    $('.dialog').html(data).dialog();
   //change URL here
  });
});

要将所有URL指向主页您必须执行服务器端技巧,请将所有URL指向index.php。例如
example.com/index.php/subpage
并在文档准备就绪时检查URL是否不仅仅是
index.php
我指的是
example.com/index.php/subpage
之类的内容,然后在对话框中打开
example.com/index.php/subpage?content\u only
。在
index.php
中,使用一个条件,指定了
content\u only
,然后只返回
子页面的内容,不带模板和JS。

谢谢您的快速回答。但是你的sugested方法并不完全有效,因为当你在URL地址栏中输入www.demopage.com/example.php时,它将只打开example.php,而不会在后台打开主页。这件事有点棘手和详细,无论如何我已经更新了答案。