回复:Re: [wxPython-users] what is different betw een webview.LoadURL and webview.SetPage

<[email protected]>
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
I had saw the document "URL for resolving relative links"
In fact, I want convert some markdown to html, then show them in webview. So where is the ralative linkes' root?
the text below, save as a html file and use LoadURL is OK, but SetPage not works. Is it the matter of url setting?
====================================<html lang="zh-cn">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
</head>
<script type="text/x-mathjax-config">
 MathJax.Hub.Config({
   config: ["MMLorHTML.js"],
   jax: ["input/TeX", "output/HTML-CSS", "output/NativeMML"],
   extensions: ["MathMenu.js", "MathZoom.js"]
 });
</script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js"></script>
<body>
 <p>
     <script type="math/tex; mode=display">x^2</script>
 </p>
</body>
</html>===================================----- 原始邮件 -----
发件人:Scott Talbert <[email protected]>
收件人:wxpython-users <[email protected]>
主题:Re: [wxPython-users] what is different between webview.LoadURL and webview.SetPage
日期:2020年01月29日 00点48分


On Wed, 29 Jan 2020, [email protected] wrote:
> I have a html text, there is <script> tag in it, and the script need load
> some out source.
> 
> if I save it as a xxx.htm, and use LoadURL(file:///xxxx.htm), we can get the
> result.
> but if I use SetPage, I get a blank page.
> 
> I saw the SetPage has 2 parameter, the second one is url, what should I
> give?
> does the SetPage method run the js as LoadURL?
SetPage() allows you to provide the HTML you want to be displayed as a 
string, or wx.InputStream.  The second parameter is for providing a base 
URL for resolving relative links.  See documentation for SetPage():
https://docs.wxpython.org/wx.html2.WebView.html?highlight=webview#wx.html2.WebView.SetPage
You probably just want to use LoadURL, but if you wanted to use SetPage(), 
you could load your page into a string and then pass that to SetPage().
Scott
-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/alpine.DEB.2.21.2001281144560.3710%40bear.techie.net.

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/20200129014722.C385A464046E%40webmail.sinamail.sina.com.cn.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.