Top. location. href does not have permission for Solution

Source: Internet
Author: User

In this way, if someone saves my webpage or uses iframe to include it, then the page will jump directly to my article page. The test was successful in the past, today, I saw a website that included my page. I think my homepage has nothing to do with iframe, but after clicking the inner page, I found that my website has not been accessed, the error message "no access permission" is displayed when you check the javascript error message. The problem persists after the local test. It seems that the problem is not caused by the other website, but by my website, is top. location. href problems are mostly used on the Internet in the same way as I did. After searching for a long time, I finally got a solution:

This is a cross-origin problem. Add the following sentence,

Try {top. location. host} catch (exp) {top. location = http://www.jb51.net ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.