iPhone – Submit a form in UIWebView with HTMLString: BaseURL:?

Ojing,

I am displaying an html page which contains a form with some input text fields and a submit button.

>If I use loadRequest to display the page: everything works.
>If I use loadHTMLString to display the same page: baseURL: the submit button no longer works.

The address that should be called is:

http://…./lire.php?id=33570#bloc_commentaire

If I record the address, it tries to reach I get:

applewebdata://BF6F3D92-9F36-40CA-A3EB-BCD3F14852B6#bloc_commentaire

Do you know what I should do to publish a statically loaded form using loadHTMLString: baseURL

Thank you,
Vincent

This problem is Because your web view doesn’t know where to post the data, because the html is loaded from a string instead of a specific web server.

Make sure that the baseURL is set correctly during the call

< p>

[webView loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL]

Details:

When webview finds relative url in html When, it will connect it with baseURL to form an absolute URL, which can be used to submit or click. For example:

Given that http://www.test.com/foo/ is the baseURL and relative URL tags lke< a href = "bar / hello.php">Please click me

When the user clicks on the link, the view will change to http://www.test.com/foo/bar/ hello.php makes a request

Oi,

I am displaying an html page which contains a text field with some input and A form with a submit button.

>If I use loadRequest to display the page: everything is normal.
>If I use loadHTMLString to display the same page: baseURL: the submit button no longer works.

< p>The address that should be called is:

http://…./lire.php?id=33570#bloc_commentaire

If I record the address, it tries to reach what I get :

applewebdata://BF6F3D92-9F36-40CA-A3EB-BCD3F14852B6#bloc_commentaire

Do you know what should I do Only do so to publish the statically loaded form using loadHTMLString: baseURL

Thank you,
Vincent

This problem occurs because of you The web view does not know where to post the data, because the html is loaded from a string instead of a specific web server.

Make sure that the baseURL is set correctly during the call

[webView loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL]

Details:

When webview finds a relative URL in html, It will connect it with baseURL to form an absolute URL, which can be used to submit or click. For example:

Given that http://www.test.com/foo/ is the baseURL and relative URL tag lke< a href = "bar / hello.php">Please click me

When the user clicks on the link, the view will change to http://www.test.com/foo/bar/hello. php makes a request

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1086 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.