嵌入html网站的部分内容

问题描述:

对于我的学校,我们使用一个名为HomeLogic的家庭作业网站。我想把这个网站的作业块放到我自己制作的自定义主页中。



这是作业框架的代码。


For my School we use a homework website called HomeLogic. I want to take the assignments block of that website and put it into a custom Homepage that I have made.

Here is the code of the "Assignments" frame.

<frame name="Assignments" id="Assignments" src="Home_Assignments.asp?"
scrolling="auto" noresize="" marginwidth="0" marginheight="0" frameborder="0">





但是有一个问题。要进入本网站,您需要输入用户名密码。如何将此框架嵌入我的主页并自动登录,以便查看作业?提前谢谢,杰克。



But there is one problem. To enter into this Website you would need to enter a username and a password. How can I embed this frame into my homepage and make it automatically login so I can see the assignments? Thanks in advance, Jake.

您很可能必须看看Homelogic是否有允许您抓取内容的API。
You would most likely have to see if Homelogic has an API that allows you to grab the content.


我认为你应该在框架中显示登录页面。当用户输入用户名,密码并单击登录按钮时,它将自动重定向到下一页。



但是即使您正在显示需要登录的其他页面,如果该应用程序具有在用户未登录时重定向回登录的代码,则您的问题是解决了。它还应该在登录后重定向回最初请求的页面。如果这不可用,那么请使用第一种方法。
I think you should show the login page in the frame. When user enter username, password and clicks the sign in button, it will automatically redirect to the next page.

But even if you are showing a different page which requires login, if that app has that code to redirect back to login when user is not logged in, your issue is solved. It should also redirect back to the initially requested page after login. If this is not available, then go with the first method.


除了Paul的答案(解决方案#1),您可以使用 Window.postMessage() [ ^ ],这是跨文档消息 [ ^ ]



-KR
Addition to Paul's answer (Solution #1), you can use Window.postMessage()[^], which is concept of Cross-Document Messaging[^]

-KR