How to append html in Nuxt with universal mode - append

I try to append HTML in js file. It was OK for SPA mode.
But when I change to universal mode, the HTML can't be appended.
Then I try to set the timeout for append function and it's Ok. The HTML is appended successfully.
I don't understand the reason why?
I just a new member in nuxt, so please help me explain the reason why, and how can I append HTML without set timeout?
Thanks so much!

Without seeing the code you are using to try and implement appending html I can't be certain, but I suspect the process where the appending is to happen is taking place on the server, before it is rendered to the client.
To get around this you could implement the use of process.client to delay the appending.
if (process.client) {
//do what needs to be done
}
The other option would be to use the mounted hook to call to append the html.
As I say, if you post the code you are trying to use it would be possible to show a more detailed answer.

Related

Print page content

I just started playing with google chrome apps. I've searched the internet and haven't found the way to print the content of the windows. Tried using windows.print(), but nothing happened.
As far as I have read, the print() wont work since it is called in the background.html that does not have any content. How can I make the call at the correct place and send the content of the app to the printer?
Thank you in advance!
You're right that this can't be done through the Background page, since it is not rendered. What you'll need to do is inject a "content script" into the page you would like to print. The content script would contain the print command, and probably whatever would trigger the print command.
In a nutshell, "content scripts" are scripts that are injected into the pages a user browses. You can inject pretty much any JavaScript you like, and even inject entire JavaScript libraries like JQuery. More details can be found here:
https://developer.chrome.com/extensions/content_scripts.html
If you decide to use a popup window to trigger the print you can pass a message to the window you would like to print. Message passing is how the different components of an extension (background page, content script, popup) communicate. More info can be found here:
http://developer.chrome.com/extensions/messaging.html
Printing in apps is not yet supported, I believe. See
Issue 131279: async version of window.print()

Gtkwebkit, save html to pdf

Last days I search for best and shortest way to convert html files to pdf. Since I create my html files with C program and see them through gtkwebkit which uses cairo it should be some efficient and direct way to convert content of showed page to html with C (I think).
But can't find any example or direction to go on the net.
Until now, among different virtual printers, I find only commandline tools which are maded in perl or which depends on qt what is not wanted.
Please for any suggestion, example or advice to get this functionality from gtkwebkit and if not, maybe something with some tiny C library.
As far as I can tell from reading the documentation (haven't tried it out myself):
Get the main frame with webkit_web_view_get_main_frame().
Create a GtkPrintOperation with gtk_print_operation_new().
Set the export-file property on your print operation to be the name of the PDF you want to export to.
Print the frame with webkit_web_frame_print_full(). Make sure to pass GTK_PRINT_OPERATION_ACTION_EXPORT as the 'action' parameter.
I once wrote some code, to accomplish that without opening a window. But then I ran into a problem with using that code from multiple threads (in a webserver e.g.). I made some research and I figured out that gtk itself is single threaded. So I made my code thread safe, by queuing the print operations to the main thread. Anyway, if it helps, check it out... https://github.com/gnudles/wkgtkprinter

CodeIgniter send()) fail

I am learning how to use code igniter and following tutorials. As this is my first time to use MVC, I'm having some trouble implementing the send function. I am doing a tutorial on how send a newsletter sign up form.
For some reason when I hit submit with or without the info, its giving me a 404 page not found with the /send extension. Is there something I'm missing in my config file?
Here is the code
Thanks in advance.
Is not send that is failing but you missed something in your config.
http://codeigniter.com/user_guide/general/urls.html
You should set up your .htaccess according to the guide above.
Did you setup the CodeIgniter rewrite rules in your .htaccess?
Apart from the htaccess possible problem, there are a couple of things wrong in the file you posted:
1) the html <title>HEY<title> before the php class, but I hope that's a typo, right? you don't have html in your controller file, right?
2) You're getting the POST variable wrong; or better, you're confusing and mixing things.
Instead of
$this->input->$_POST('name'); //which is also sintactically wrong
should be:
$this->input->post('name').
The input class already does the retrieving of this superglobal. And unsets them in favour of its own.
3) To use an attachment, you need to call
$this->email->attach($filename);
You just declared a variable and nothing else.
4) What is $this->email->set_newline("\r\n"); ?
I don't see this function in the email class...You need to use a config file for this, or pass the value on library's inizialization:
$config['newline'] = "\r\n";
$this->email->initialize($config);

Redirect from Web query open agent on Lotus Domino?

Does anyone know a way of redirecting to another webpage from lotus domino web query an open agent? The print statement does not seem to work. A possible workaround would be very appreciated!
Something on that subject can be found here but it seems kind of flaky like this
link.
Can it be done without JavaScript and major redesign of document form?
Thanks in advance.
You do realize that the 4/5 forum is almost a decade out-of-date, right? If you're using a more recent version of Notes/Domino, I'd check the 6/7 forum (or even the 8 if you're on that release, since it's so different); here's the search results for "webqueryopen redirect"; there are a lot more possible answers.
Notes 6/7 forum results
The simplest answers to your actual question are here and here.
Better to wite to 'location:' header directly, as avoids Javascript and meta-tags.
This is from one of the responses on the thread you pointed to and should work fine - have the WQO agent simply write to a hidden field on the form. This will do a client-side redirect, so you'll get two trips to the server.
You could use your WQO to set a field
on the document called redirect. Set
the field to text and hide it from
everything. HEre's what you put in the
field (with your WQO agent):
location.replace('http://www.website.com');
In your HtmlHeadContent, put this
formula:
"" +
#NewLine + redirect + #NewLine +
""
A line of code in WQO agent does the trick, but note it still loads the page before the redirect:
Call s.Documentcontext.Replaceitemvalue("$$HTMLHead", {<meta http-equiv="REFRESH" content="0;url=http://www.etfos.hr">"})
in your agent, simply do the following
print |[| & requiredURL & |]|
Try to see if you really need to open the document instead of running an agent and pass the params in the Query_String
I think that wqo cannot redirect to another page as it will end up redirecting you to the document you either opened or are creating. I may be wrong but yesterday I was trying to either do one thing or the other based on the params I was passing to the OpenCorm url command and it seems that although it is running the agent, the pw.println() command doesn't behave the same as if it was a WQS agent.
If you don't need to open a document, try running an agent and pass the params to it
The proper way to do it is to have one print statement with the URL you want to redirect to in brackets. This will generate a 302 REDIRECT on the server.
Example code:
%REM
Agent redirect
Trigger: On Schedule - Never
Target: None
Security Level: 1
%END REM
Option Public
Option Declare
Sub Initialize
Print "[http://www.ibm.com]"
End Sub
Some people have suggested Meta Refresh. This is discouraged by the W3C. See the following link:
http://en.wikipedia.org/wiki/Meta_refresh#Usability

Periodically calling TinyMCE's triggerSave function

If anyone knows TinyMCE well, do you know if it has built-in support for periodically calling its triggerSave function?
(This function copies it's content to its "parent" textarea. I want to observe said textarea for changes so I can implement autosave.)
Thanks
Don't try autosave, trust me on this one. triggerSave is buggy and when it fails it fails silently so you think that your content got posted, but in reality it didn't. After it fails once it will no longer work for the rest of the session, as in until the page is manually reloaded and tinymce does another full init().
Just got bit by this one badly, again. Never again trust triggerSave.
You could easily do this yourself by using JavaScript's setTimeout() function.
See http://www.w3schools.com/js/js_timing.asp.