How to redirect Javascript Onload without modifying any of the http host and headers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to redirect Javascript Onload without modifying any of the http host and headers?

I used a javascript redirect to a IP of a shared hosting, direct IP access is not allowed. The only way for me to redirect and load the page is with the original http host.

14th Dec 2017, 11:25 PM
Bryan Genius
Bryan Genius - avatar
5 Answers
+ 4
do you want to go to that page, or u want to load the content on the current page instead?
16th Dec 2017, 1:02 PM
EnRico Lam
EnRico Lam - avatar
+ 4
u need a ajax request to the page u want, or a more simplier method, load the desired page in an iframe on current page, and get the html in the iframe, then use document.write to load it, this is important however , the iframe method only works for pages with same origin
16th Dec 2017, 1:21 PM
EnRico Lam
EnRico Lam - avatar
+ 4
origin of a page: e.g. www.google.com if u use www.google.jp or google.com, things wont work
16th Dec 2017, 1:22 PM
EnRico Lam
EnRico Lam - avatar
+ 3
or a most idiotic method, use an iframe, and then set style="width:100%;height:100%;"
16th Dec 2017, 1:31 PM
EnRico Lam
EnRico Lam - avatar
0
Just load the content from the intended page
16th Dec 2017, 1:05 PM
Bryan Genius
Bryan Genius - avatar