开发者

Check if a page is opened in an overlay

How can I determine if a page is opening in an overlay or in a browser window?

To be more exact, it's download page behavior from GitHub: if you click on the Downloads button from this page, it will open a facebox overlay. However, if you copy the address from the respective link开发者_如何学运维 and paste it into a new tab, it will open as a new page.

So how do you check to see where is the page opening (assuming PHP)?

Edit:

This was what I was looking for.


I think you need to do the checking on the client using JavaScript and PHP is not going to help you on this one. As far as I can tell from your post you need figure out how the page is loaded. Probably it is an iframe or such. Of that you must be able to retrieve the loaded address.


I don't know why you would want to check that, but as you can see the link has an id="download_button". And in the bundle_hithub.js file the download_button is associated with the popup event. I don't know how exactyly, it's hard to read those single-line compressed JS files.


if the page that is going to be loaded has the following script

<script type="text/javascript">
    window.location = "http://page-loads";
</script>

it won't run when loaded through an ajax call (since the page will most likely be appended with an innerHTML way resulting in the script being appended in the document, but not ran)

but when opened solely in the browser window - the script will run taking the user away to the desired destination!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜